2017-08-09 171 views
-5

我有一个选项卡式活动,它具有超过3个选项卡(3个选项卡是标准选项),但它们都压扁在一起,我想知道是否有某种选项可以更改,我可以有超过3个没有压扁的标签。例如,直到您滑过它们,它们才会显示在屏幕上。带有超过3个选项卡的选项卡式活动

我一直在寻找一段时间,似乎无法找到一个答案,每个人似乎只有3个标签的快乐。

+2

使用'TabLayout'用'Scrollable'模式。 – Piyush

回答

0

滚动标签

,当你有许多许多选项卡哪里有屏幕,以适应所有的空间不足的滚动标签应使用他们。要使选项卡可滚动,请将app:tabMode =“可滚动”设置为TabLayout。

这样

<android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:tabMode="scrollable"/> 
+0

工作干杯。非常感谢! – Patrick

0

添加app:tabMode="scrollable",它会滚动

<android.support.design.widget.TabLayout 
       android:id="@+id/tabs" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       app:tabMode="scrollable" <!--add this-->/> 
+0

感谢您的答复,这工作。 – Patrick

相关问题