From 90a4f86fc976b9d8429b96bf6fff4e63f4b484e5 Mon Sep 17 00:00:00 2001 From: baoxing <312904694@qq.com> Date: Mon, 10 Jun 2019 11:11:53 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=A2=9E=E5=8A=A0=E8=B4=9F=E5=80=BC=202.?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0dimen=E5=AD=97=E7=AC=A6=E4=B8=B2tip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../main/java/com/example/lib/utils/MakeUtils.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) 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); }