【发布时间】:2010-12-16 10:57:13
【问题描述】:
我正在尝试创建一个选项卡 UI,但我不想在 tabHosts 上放置任何图像,因此我决定使用 setIndicator(CharSequence 标签)而不是使用 setIndicator(CharSequence label,Drawable icon)。然后在没有图像的情况下创建 tabHost,但在高度较小且仅包含 CharSequence 的情况下,它与带有图像的常规 tabHost 具有相同的高度。图像通常位于的顶部有一个空闲空间,而文本位于该空间下方。无论如何要删除为图像保留的可用空间,或者翻转两者,以便文本位于顶部,之后我可以设置一个 15dp 的 layout_height 。主布局的 .xml 代码是
<?xml version="1.0" encoding="utf-8"?>
<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:orientation="vertical"
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
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
【问题讨论】:
标签: android xml android-tabhost