From c8e6f23015e405edc179327a221a264b4df4b670 Mon Sep 17 00:00:00 2001 From: Tor Norbye Date: Thu, 3 Jan 2013 10:03:51 -0800 Subject: 27869: Lint rule for LinearLayout which doesn't specify orientation This adds a check for cases where you have a LinearLayout which does not specify an orientation (meaning it's horizontal), yet it contains multiple children, and one of the children prior to the last one sets its width to fill_parent or match_parent (without a weight). This is a common pitfall for new developers who create the layout and assume it's vertical, and at runtime only see the first child, not realizing the remainder are off screen to the right. Change-Id: Ief9604d8a8fc84849d1a8f2df6d7ec0b75b13eaa --- .../android/tools/lint/checks/InefficientWeightDetectorTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lint/cli') diff --git a/lint/cli/src/test/java/com/android/tools/lint/checks/InefficientWeightDetectorTest.java b/lint/cli/src/test/java/com/android/tools/lint/checks/InefficientWeightDetectorTest.java index 644bb10..c642ab1 100644 --- a/lint/cli/src/test/java/com/android/tools/lint/checks/InefficientWeightDetectorTest.java +++ b/lint/cli/src/test/java/com/android/tools/lint/checks/InefficientWeightDetectorTest.java @@ -27,14 +27,16 @@ public class InefficientWeightDetectorTest extends AbstractCheckTest { public void testWeights() throws Exception { assertEquals( + "res/layout/inefficient_weight.xml:3: Error: Wrong orientation? No orientation specified, and the default is horizontal, yet this layout has multiple children where at least one has layout_width=\"match_parent\" [Orientation]\n" + + "