From 3577f51d4bc236a11e283855337752a7b6897f8b Mon Sep 17 00:00:00 2001
From: Scott Main 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_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