I need to access the view presented in a.xml layout included in another b.xml layout. For example, This is a.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/xyz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="XYZ" />
</RelativeLayout>
And, in b.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<include
android:id="@+id/a_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
layout="@layout/a" />
<TextView
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/xyz"
android:text="Show me below xyz" />
</RelativeLayout>
I need to do this in xml code, because if I do this in Java, it should be after setContentView (), and then setting LayoutParams from the TextView label will not work.
I think everyone understands what I'm trying to ask. Waiting for good answers.
Thanks to everyone.
The image on the right is what I am trying to achieve, and left one thing - this is what I get with the current code.


source
share