I'm wondering if this is possible:
In a layout file, I've included a view:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include
layout="@layout/includedView" />
</LinearLayout>
That includedView contains this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="48dip" >
<ImageView
...
/>
<TextView
....
/>
</RelativeLayout>
My question is: is it possible to set the text for the textview inside the includedView from the layout that includes the view (so from layout 1)?
Hope my question is clear, if not, then please ask.
you can do that from code as same as single layout. for example
setContentView(R.layout.first_layout);
TextView tv = (TextView)findViewById(R.id.textview_of_second_layout); // just like single layout
tv.setText(something);
But I think it is not possible to do this from the first layout xml as there is no visible way. (someone corrects me if I am wrong)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With