如何在android中完全显示选项卡标题
我是android的新手。我开发了一个显示15个标签的android应用程序。一个问题是我无法完全看到每个选项卡的标题。是的,android中的选项卡是可滚动的。 我使用下面的代码创建选项卡。寻找更好的解决方案 main.xml如何在android中完全显示选项卡标题,android,Android,我是android的新手。我开发了一个显示15个标签的android应用程序。一个问题是我无法完全看到每个选项卡的标题。是的,android中的选项卡是可滚动的。 我使用下面的代码创建选项卡。寻找更好的解决方案 main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orient
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="match_parent" android:orientation="vertical">
<TabWidget android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@android:id/tabs"></TabWidget>
<FrameLayout android:layout_width="match_parent" android:layout_height="500px" android:id="@android:id/tabcontent">
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab1">
<TextView android:text="Tab1 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab2">
<TextView android:text="Tab2 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab3">
<TextView android:text="Tab3 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab4">
<TextView android:text="Tab4 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab5">
<TextView android:text="Tab5 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab6">
<TextView android:text="Tab6 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab7">
<TextView android:text="Tab7 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab8">
<TextView android:text="Tab8 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab9">
<TextView android:text="Tab9 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab10">
<TextView android:text="Tab10 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab11">
<TextView android:text="Tab11 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab12">
<TextView android:text="Tab12 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab13">
<TextView android:text="Tab13 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab14">
<TextView android:text="Tab14 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab15">
<TextView android:text="Tab15 Clicked" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
您可以在android中使用布局xml文件中的HorizontalScrollView创建滚动选项卡
<HorizontalScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</HorizontalScrollView>
请浏览以下链接以供参考:
希望这将帮助您解决问题。您可以在android中使用布局xml文件中的水平滚动视图制作滚动选项卡
<HorizontalScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</HorizontalScrollView>
请浏览以下链接以供参考:
希望这将帮助您解决您的问题