I try to develop left TabLayout like this image.

ce8ffb57ae8e9d1cd8f4dfab1aa45c92.png

但是问题是TabLayout元素没有显示并垂直滚动.下面是我的代码,也许我错过了一些东西:

xmlns:app="http://schemas.android.com/apk/res-auto"

android:layout_width="match_parent"

android:layout_height="match_parent">

android:id="@+id/viewpager"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_toRightOf="@+id/appBarLay"

app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

android:id="@+id/appBarLay"

android:layout_width="wrap_content"

android:layout_height="match_parent"

android:layout_alignParentLeft="true"

android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

android:id="@+id/tabs"

android:layout_width="60dp"

android:layout_height="match_parent"

app:tabBackground="@drawable/tab_color_selector"

app:tabGravity="fill"

app:tabMode="scrollable" />

解决方法:

如android文档中所述,请参阅this

TabLayout provides a horizontal layout to display tabs.

这意味着您不能使用TabLayout显示垂直选项卡.但是,您可以使用TabHost来实现它.

看看这些喜好:

标签:tabs,slider,android,scroll

来源: https://codeday.me/bug/20191111/2023060.html

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐