您好,我需要一些有关 Tab 的帮助。有一些布局建议需要咨询。 我当前的选项卡内容似乎与我的选项卡重叠。无论如何要阻止这种情况发生吗?
main.xml
<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">
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</FrameLayout>
</LinearLayout>
</TabHost>
最佳答案
好吧,您已将选项卡放入选项卡内容中。正确的布局是这样的
<LinearLayout>
<TabWidget />
<FrameLayout />
</LinearLayout>
我猜你正在关注this tutorial 。第一个 XML 布局就是您的布局。
关于Android Tab内容与选项卡重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30221342/