From 3577f51d4bc236a11e283855337752a7b6897f8b Mon Sep 17 00:00:00 2001
From: Scott Main You can include any other layout attributes in the Caution: If you want to override the layout dimensions,
+you must override both Another way to include a layout is to use {@link android.view.ViewStub}. It is a lightweight
View that consumes no layout space until you explicitly inflate it, at which point, it includes a
layout file defined by its {@code android:layout} attribute. For more information about using {@link
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_heightandroid:layout_width is also declared.
android:layout_widthandroid:layout_height is also declared.
<include> that are
supported by the root element in the included layout and they will override those defined in the
root element.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.)android:layout_* attribute can be used with the <include
-/> tag. Here is an example:
<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_heightand +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