TabLayout的下划线是可以在drawable里面定义的
<com.google.android.material.tabs.TabLayout
android:layout_width="wrap_content"
android:layout_height="35dp"
android:background="@color/white"
app:tabGravity="center"
app:tabTextColor="#666263"
app:tabIndicatorColor="@color/works_tab"
app:tabIndicatorHeight="4dp"
app:tabMode="fixed"
app:tabIndicator="@drawable/tablayout_indicator_bg"
app:tabSelectedTextColor="@color/works_tab"
app:tabTextAppearance="@style/TabLayoutTextStyle"
app:tabPaddingStart="65dp"
app:tabPaddingEnd="68dp"/>```
这是资源文件
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:gravity="center_horizontal">
<shape>
<corners android:radius="5dp" />
<size android:width="9dp"
android:height="4dp"/>
</shape>
</item>
</layer-list>
文字样式
<style name="TabLayoutTextStyle">
<item name="android:textSize">15sp</item>
<item name="android:textColor">#999999</item>
<item name="textAllCaps">true</item>
<item name="fontFamily">@font/font_gotham_medium</item>
</style>
|