diff --git a/.gitignore b/.gitignore index 5edb4ee..6ecd2a1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /build /captures .externalNativeBuild +.idea diff --git a/lib/src/main/java/com/example/lib/utils/MakeUtils.java b/lib/src/main/java/com/example/lib/utils/MakeUtils.java index 07bb66e..c86bb7b 100644 --- a/lib/src/main/java/com/example/lib/utils/MakeUtils.java +++ b/lib/src/main/java/com/example/lib/utils/MakeUtils.java @@ -17,8 +17,9 @@ public class MakeUtils { private static final String XML_HEADER = "\r\n"; private static final String XML_RESOURCE_START = "\r\n"; private static final String XML_RESOURCE_END = "\r\n"; - private static final String XML_DIMEN_TEMPLETE = "%3$.2fdp\r\n"; - + private static final String XML_DIMEN_TEMPLETE = "%3$.2fdp\r\n"; + private static final String XML_DIMEN_TEMPLETE_NAG = "%3$.2fdp\r\n"; + private static final String XML_TEST_TIP = "%ddp\r\n"; private static final String XML_BASE_DPI = "%ddp\r\n"; private static final int MAX_SIZE = 720; @@ -53,11 +54,17 @@ private static String makeAllDimens(DimenTypes type, int designWidth) { //备份生成的相关信息 temp = String.format(XML_BASE_DPI, type.getSwWidthDp()); sb.append(temp); + + final String xmlTip = String.format(XML_TEST_TIP, type.getSwWidthDp()); + sb.append(xmlTip); + for (int i = 0; i <= MAX_SIZE; i++) { dpValue = px2dip((float) i,type.getSwWidthDp(),designWidth); temp = String.format(XML_DIMEN_TEMPLETE,"", i, dpValue); sb.append(temp); + temp = String.format(XML_DIMEN_TEMPLETE_NAG,"", i, -dpValue); + sb.append(temp); }