diff --git a/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule b/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule index 0de935072..928d7a175 100644 --- a/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule +++ b/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule @@ -12,7 +12,7 @@ if (parent.is("LinearLayout") && node.'@android:layout_weight' && parent.'*'.findAll{ it.'@android:layout_weight' }.size() == 1) { def dimension = parent.'@android:orientation' == "vertical" ? "android:layout_height" : "android:layout_width" - if (node."@${dimension}"[0] != 0) { + if (node."@${dimension}"[0] != '0') { analysis << "Use an ${dimension} of 0dip instead of ${node."@${dimension}"} " + "for better performance" } diff --git a/tools/layoutopt/samples/inefficient_weight.xml b/tools/layoutopt/samples/inefficient_weight.xml index c687ed84f..785350a9f 100644 --- a/tools/layoutopt/samples/inefficient_weight.xml +++ b/tools/layoutopt/samples/inefficient_weight.xml @@ -25,5 +25,20 @@ android:layout_weight="1.0" /> + + + +