由于某种原因,无法将文本背景颜色更改为透明(替换白色)
在TabLayout
内:
我的TabLayout
:
<android.support.design.widget.TabLayout
android:id="@+id/reviewsFeedTabs"
app:tabBackground="@color/mainBackgroundTheme"
app:tabIndicatorColor="@color/lightMainTheme"
app:tabTextAppearance="@style/NavigationBarText"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
和我的风格:
<style name="NavigationBarText" parent="TextAppearance.Design.Tab">
<item name="android:background">@color/testGreen</item>
<item name="android:textColor">@color/testGreen</item>
<item name="android:textSize">12sp</item>
<item name="textAllCaps">true</item>
</style>
background
无法回复@color/transparent
答案 0 :(得分:0)
使用自定义样式,如
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabBackground="@drawable/tab_color_selector"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
style="@style/MyCustomTabLayout"
/>
并在你的样式文件中
<style name="MyCustomTabLayout" parent="Widget.Design.TabLayout">
<item name="tabTextAppearance">@style/MyCustomTabText</item>
<item name="tabSelectedTextColor">@color/ColorPrimary</item>
回答
答案 1 :(得分:0)
请改用:
app:tabBackground ="#80000000"