<com.google.android.material.tabs.TabLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_56"
app:tabBackground="@drawable/selector_tab_indicator"
app:tabIndicatorHeight="@dimen/dp_0"
app:tabMode="fixed"
app:tabSelectedTextColor="@color/color_FF4089"
app:tabTextAppearance="@style/CustomTabLayoutTextAppearance"
app:tabTextColor="@color/color_141414" />
<style name="CustomTabLayoutTextAppearance" parent="android:TextAppearance.Widget.TabWidget">
<item name="android:textAllCaps">false</item>
<item name="android:textSize">@dimen/sp_16</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/color_white</item>
</style>
selector_tab_indicator
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_tab_indicator_selected" android:state_checked="true"/>
<item android:drawable="@drawable/shape_tab_indicator_selected" android:state_pressed="true"/>
<item android:drawable="@drawable/shape_tab_indicator_selected" android:state_selected="true"/>
<item android:drawable="@drawable/shape_tab_indicator" />
</selector>
shape_tab_indicator_selected
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@color/color_white" />
</shape>
</item>
<item
android:top="@dimen/dp_52"
android:gravity="bottom|center_horizontal">
<shape>
<solid android:color="@color/color_FF4089" />
</shape>
</item>
</layer-list>
shape_tab_indicator
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@color/color_white" />
</shape>
</item>
<item android:top="@dimen/dp_52"
android:gravity="bottom|center_horizontal">
<shape>
<solid android:color="@color/color_FFE2ED" />
</shape>
</item>
</layer-list>
网友评论