Its very common in the UI design that some common element appear many time.
Just like some common signature in all the activities (pages) and all.
Its common that we need to set some component as reusable component.
In this case we can use the. This element does exactly what its name suggest.
To use this is very simple
Declare the reusable component as one layout in the /res/layout, let say commonlayout.xml
Then where ever you need to refer this you can use the following code
Just like some common signature in all the activities (pages) and all.
Its common that we need to set some component as reusable component.
In this case we can use the
<include />
tagTo use this is very simple
Declare the reusable component as one layout in the /res/layout, let say commonlayout.xml
Then where ever you need to refer this you can use the following code
<include android:id="@+id/id" layout="@layout/commonlayout"/>
- Here you can override all the layout parameters. This means that any
android:layout_*
attribute can be used with the<include />
tag - If you want to override the layout dimensions, you must override both
android:layout_height
andandroid: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.)