【发布时间】:2014-11-10 06:42:22
【问题描述】:
所以根据这个-http://developer.android.com/training/improving-layouts/reusing-layouts.html,我可以使用include标签来重用布局。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:background="@color/app_bg"
android:gravity="center_horizontal">
<include layout="@layout/titlebar"/>
<TextView android:layout_width=”match_parent”
android:layout_height="wrap_content"
android:text="@string/hello"
android:padding="10dp" />
...
</LinearLayout>
是否可以将元素放在包含标签中。
例如:
<include layout="@layout/titlebar">
<Button/>
</include>
如果没有,我怎样才能得到类似的效果。
我的目标是能够使包含标签成为根元素。
【问题讨论】:
标签: android android-xml