我想知道如果这是可能的设置文本:安卓:包括视图
在布局文件,我已经包括了一个观点:
<?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>
这includedView包含此:
<?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>
我的问题是:是否有可能从包含视图的布局(因此来自布局1)为includedView内的textview设置文本?
希望我的问题很清楚,如果不是,请问。
在此先感谢!
是的,有可能,您可以参考该视图作为整体包括布局被复制到主布局文件。 – Analizer
是的,正如Analizer所说,这是可能的..... –
但包含的布局不是一个textview,包含的布局包含一个textview。这很重要吗? – Xander