我正在使用Material Design库并使用CoordinatorLayout
,AppBarLayout,RecyclerView
和TabLayout
创建布局。无法看到TabLayout设计支持库中的Tab指示符
我的问题是我无法在Tablayout
中看到Tab指示符。下面是我在AppCompactActivity
中使用的xml文件。
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coodinate_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btn_next_screen">
<android.support.v7.widget.RecyclerView
android:id="@+id/list_recycle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="30dp"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
<android.support.design.widget.AppBarLayout
android:id="@+id/abar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
>
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabBackground="@color/tab_bg"
app:tabIndicatorColor="@color/tab_indicator"
app:tabIndicatorHeight="5dp"
app:tabMode="fixed"
></android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
app:layout_anchor="@+id/list_recycle"
app:layout_anchorGravity="bottom|right"
android:id="@+id/floatin_ab_home"
app:fabSize="mini"
android:src="@drawable/ic_content_add"
/>
</android.support.design.widget.CoordinatorLayout>
下面是屏幕不显示选项卡指示器,可我所缺少任何一个知道。
好的,我们的我检查和你有任何其他的方式来使工作背景颜色变化和选项卡指示器的颜色。 – Herry
目前还没有解决方案。但是你可以将自定义视图传递给选项卡。因此,对于每个选项卡,您可以传递包含textView和ImageView的LinearLayout。您可以将背景颜色设置为LinearLayout。 – Moinkhan
仍然坚持在v23 +太 –