是否可以设置TabWidget高度并调整标签标签?
如果我将TabWidget高度设置得太小,则标签将从视图中隐藏.
<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"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="30px" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
Run Code Online (Sandbox Code Playgroud)
谢谢
Van*_*nja 17
以下代码调整选项卡上的高度:
for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++) {
tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 33;
}
Run Code Online (Sandbox Code Playgroud)
但是,这将在未选择的选项卡的背景颜色上产生缺陷.我还不知道如何解决这个问题.有些论坛建议,如果不制作自定义标签小部件,它就无法解决.
| 归档时间: |
|
| 查看次数: |
17377 次 |
| 最近记录: |