gpt4 book ai didi

XML 中的 Android 选项卡

转载 作者:行者123 更新时间:2023-11-29 14:08:20 26 4
gpt4 key购买 nike

我的问题很简单。是否可以完全在 xml 中创建选项卡?我的应用只有一项 Activity 。我想要 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>

关于XML 中的 Android 选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5362589/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com