summaryrefslogtreecommitdiffstats
path: root/docs/html/resources/articles
diff options
context:
space:
mode:
authorScott Main <smain@google.com>2010-11-24 12:43:08 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-11-24 12:43:08 -0800
commit9e3d14c4aad7e41406f633734973b191c21b5c5c (patch)
tree4eaec446b09804aedc1ba5162b750e29949e1d09 /docs/html/resources/articles
parent9df7f31359866a77a47c9fab3171c71715fd0056 (diff)
parent93116f8fb171a3cf0e9b68b70e2b275a8b6a32f7 (diff)
downloadframeworks_base-9e3d14c4aad7e41406f633734973b191c21b5c5c.zip
frameworks_base-9e3d14c4aad7e41406f633734973b191c21b5c5c.tar.gz
frameworks_base-9e3d14c4aad7e41406f633734973b191c21b5c5c.tar.bz2
am 93116f8f: am 3577f51d: docs: clarify <include> layout properties bug: 3227820
* commit '93116f8fb171a3cf0e9b68b70e2b275a8b6a32f7': docs: clarify <include> layout properties bug: 3227820
Diffstat (limited to 'docs/html/resources/articles')
-rw-r--r--docs/html/resources/articles/layout-tricks-reuse.jd18
1 files changed, 15 insertions, 3 deletions
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
<code>android:layout_*</code> attribute can be used with the <code>&lt;include
-/&gt;</code> tag. Here is an example:</p>
+/&gt;</code> tag. Here is an example in
+which the same layout is included twice, but only the first one overrides the layout properties:</p>
-<pre class="prettyprint">&lt;include android:layout_width="fill_parent" layout="@layout/image_holder" /&gt;
-&lt;include android:layout_width="256dip" layout="@layout/image_holder" /&gt;
+<pre>
+&lt;!-- override the layout height and width --&gt;
+&lt;include layout="@layout/image_holder"
+ android:layout_height="fill_parent"
+ android:layout_width="fill_parent" /&gt;
+&lt;!-- do not override layout dimensions; inherit them from image_holder --&gt;
+&lt;include layout="@layout/image_holder" /&gt;
</pre>
+<p class="caution"><strong>Caution:</strong> If you want to override the layout dimensions,
+you must override both <code>android:layout_height</code> and
+<code>android:layout_width</code>&mdash;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.)</p>
+
<p>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 <code>layout/</code> directory and can