From 3577f51d4bc236a11e283855337752a7b6897f8b Mon Sep 17 00:00:00 2001 From: Scott Main Date: Wed, 24 Nov 2010 11:24:33 -0800 Subject: docs: clarify layout properties bug: 3227820 Change-Id: Id5130cd805ee2ea545a795019fb375ffd841727f --- docs/html/resources/articles/layout-tricks-reuse.jd | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'docs/html/resources/articles') diff --git a/docs/html/resources/articles/layout-tricks-reuse.jd b/docs/html/resources/articles/layout-tricks-reuse.jd index 072ba89..396e212 100644 --- a/docs/html/resources/articles/layout-tricks-reuse.jd +++ b/docs/html/resources/articles/layout-tricks-reuse.jd @@ -53,12 +53,24 @@ attributes of the included layout. The above example shows that you can use layout; it will also override the id of the included layout if one is defined. Similarly, you can override all the layout parameters. This means that any android:layout_* attribute can be used with the <include -/> tag. Here is an example:

+/> tag. Here is an example in +which the same layout is included twice, but only the first one overrides the layout properties:

-
<include android:layout_width="fill_parent" layout="@layout/image_holder" />
-<include android:layout_width="256dip" layout="@layout/image_holder" />
+
+<!-- override the layout height and width -->
+<include layout="@layout/image_holder"
+    android:layout_height="fill_parent"
+    android:layout_width="fill_parent" />
+<!-- do not override layout dimensions; inherit them from image_holder -->
+<include layout="@layout/image_holder" />
 
+

Caution: If you want to override the layout dimensions, +you must override both android:layout_height and +android:layout_width—you cannot override only the height or only the width. +If you override only one, it will not take effect. (Other layout properties, such as weight, +are still inherited from the source layout.)

+

This tag is particularly useful when you need to customize only part of your UI depending on the device's configuration. For instance, the main layout of your activity can be placed in the layout/ directory and can -- cgit v1.1