【发布时间】:2011-11-09 09:09:36
【问题描述】:
我在底部有一个带有自定义 TabWidgets 的 TabActivity。我希望能够添加超过 5 个标签。与动态添加“更多”按钮的菜单栏不同,选项卡只是调整了大小并且看起来很糟糕。所以我的第一次尝试是将我的 TabWidgets 包装到一个 HorizontalScrollView 中。问题是,我有一个 ListView 作为 TabContent,它的最后一项似乎隐藏在我的 TabWidgets 后面。 这是我的 TabView 的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_linlay_parent"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/main_tablinear"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_above="@android:id/tabs"/>
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none"
android:layout_alignParentBottom="true">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"/>
</HorizontalScrollView>
</RelativeLayout>
</TabHost>
</LinearLayout>
我在布局中做错了吗?有没有更好的方法来应用超过 4 个选项卡?虽然我的 Nexus-S 可以看到 4 个标签很好,但我认为它们在 Wildfire 上已经很难看。任何想法表示赞赏
【问题讨论】:
-
只有在添加超过 4 个标签时才开始滚动吗?我的有 5 个标签,但它仍然将所有内容都挤在...
标签: android layout tabs horizontal-scrolling