我想在Tabindicator图像内设置Tablayout。但是我尝试在tabindicator上设置图像运行时原色显示。 请帮助我。
我的TabLayout喜欢。
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/download_tab_bg"
app:tabTextAppearance="@style/customfontstyle"
app:tabIndicatorHeight="2dp"
app:tabIndicator="@drawable/tab_activeline_bg"
app:tabTextColor="@color/White">
<com.google.android.material.tabs.TabItem
android:id="@+id/tabItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tab_historyinsta" />
<com.google.android.material.tabs.TabItem
android:id="@+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tab_historyfb" />
<com.google.android.material.tabs.TabItem
android:id="@+id/tabItem3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tab_historywp" />
</com.google.android.material.tabs.TabLayout>
tab_activeline_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="0"
android:endColor="#2AB200"
android:centerColor="#3560AE"
android:startColor="#F5242A"
android:type="linear" />
</shape>
在上述布局中,请勿设置tabindicator可绘制的tab_activeline_bg.xml。 帮我。 感谢你。