Android Tab内容与选项卡重叠

标签 android xml android-layout tabs

您好,我需要一些有关 Tab 的帮助。有一些布局建议需要咨询。 我当前的选项卡内容似乎与我的选项卡重叠。无论如何要阻止这种情况发生吗?

Problem with layout

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/

相关文章:

android - 在 android 中旋转 Canvas 时图像被剪裁?

java - 连接到 Mpos 设备抛出 java.nio.channels.IllegalBlockingModeException

xml - Xquery 3.0 按属性值分组

Android 应用程序在首次启动时显示空白屏幕但在重新启动时显示内容

android - Actionbarsherlock 开关操作栏覆盖模式以编程方式

android - 更快的 adb 命令(跳过每个命令的延迟)

android - 是否存在日期偏好?

xml - xsl :for-each loop counter

ruby - 解析巨大的(~100mb)kml(xml)文件需要*小时*而没有任何实际解析的迹象

java - 在 Activity 之上打开 fragment 的最佳实践是什么