【发布时间】:2017-01-02 07:04:48
【问题描述】:
我尝试像这张图片一样开发left TabLayout。
但问题是TabLayout 元素没有显示和垂直滚动。下面是我的代码,也许我错过了一些东西:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
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.support.design.widget.AppBarLayout
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.support.design.widget.TabLayout
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.support.design.widget.AppBarLayout>
</RelativeLayout>
【问题讨论】:
-
Tablayout 不适用于垂直滚动,它们仅用于水平滚动。我觉得你应该看看别的。
-
@PriyaSinghal ,什么是正确的方法请建议我。我在 GitHub 上找到了一些库,但还有其他方法吗?
-
使用可以使用具有固定宽度的 ListView 或 RecyclerView,因为我认为您需要使用选定的选项类型填充屏幕......您尝试制作的 UI 也是在IOS 的指导方针,如果可能的话,请你的设计师将设计作为 android 的指导方针。
-
@PriyaSinghal 你是对的,这是 IOS 设计指南,但没有其他办法。现在我跟随 RecyclerView 来做这个。谢谢。
标签: android scroll tabs slider