我正在使用android.support.design.widget.TabLayout。
我想设置一个垂直线分隔符,将一个标签与另一个标签分开。
我找不到任何可以在Xml或代码级别设置的属性。
请告知。
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/tab_layout"
android:layout_width="match_parent"
app:tabIndicatorHeight="2dp"
android:theme="@style/ArticlesTabLayout" />
使用寻呼机附加TabLayout的代码:
TabLayout tabLayout = getTabLayout();
tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
tabLayout.setupWithViewPager(viewPager);
风格是:
<style name="ArticlesTabLayout" parent="Widget.Design.TabLayout">
<item name="tabMaxWidth">@dimen/tab_max_width</item>
<item name="tabIndicatorColor">@color/cba_yellow</item>
<item name="tabIndicatorHeight">2dp</item>
<item name="tabPaddingStart">12dp</item>
<item name="tabPaddingEnd">12dp</item>
<item name="tabBackground">@color/cba_white</item>
<item name="tabTextAppearance">@style/ArticleTabTextAppearance</item>
<item name="tabSelectedTextColor">?android:textColorPrimary</item>
</style>
<style name="ArticleTabTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">14sp</item>
<item name="android:textColor">?android:textColorSecondary</item>
<item name="textAllCaps">false</item>
</style>