【发布时间】:2011-03-19 14:07:56
【问题描述】:
我的问题很简单。是否可以完全在 xml 中创建选项卡?我的应用程序只有一项活动。我希望有 2 个选项卡显示相同的数据,但布局略有不同。看起来应该是,但我在上面找不到任何东西。
TIA,
标记
【问题讨论】:
我的问题很简单。是否可以完全在 xml 中创建选项卡?我的应用程序只有一项活动。我希望有 2 个选项卡显示相同的数据,但布局略有不同。看起来应该是,但我在上面找不到任何东西。
TIA,
标记
【问题讨论】:
你可以做这样的事情。每个选项卡的布局都将放在一个选项卡小部件中。如果您使用简单的 TabHost,这将有它的限制,您可以轻松解决
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Tabs at bottom of screen -->
<TabWidget
android:background="@drawable/textview_top"
android:layout_weight="12"
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="0dip"
/>
</TabHost>
【讨论】: