开发者

How to specify text view when I use include in my layout xml file

I have a layout xml file which includes another smaller xml file.

<include layout="@layout/text" android:id="@+id/test1"/>
<i开发者_开发技巧nclude layout="@layout/text" android:id="@+id/test2"/>

where my text.xml is

<merge xmlns:android="http://schemas.android.com/apk/res/android">
        <TextView android:id="@android:id/text1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
        />
</merge>

My question is how can I specify different text view in my text view in test1 and test2 in my layout xml file? Or I have to do that in my java code?

Thank you.


Similar to this answer on SO: https://stackoverflow.com/a/10821976/2543138. Yes, it can be done in xml, you just have get the id of the include first in the code and then get the text element.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜