diff --git a/docs/html/guide/topics/resources/layout-resource.jd b/docs/html/guide/topics/resources/layout-resource.jd index 111851c0c60e5..36369d35f1981 100644 --- a/docs/html/guide/topics/resources/layout-resource.jd +++ b/docs/html/guide/topics/resources/layout-resource.jd @@ -149,17 +149,23 @@ resource.
android:layout_heightandroid:layout_width is also declared.
android:layout_widthandroid:layout_height is also declared.
You can include any other layout attributes in the <include> that are
supported by the root element in the included layout and they will override those defined in the
root element.
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.)
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 072ba8915561f..396e212757ac7 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:
<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