How do you set text-color for a tab that's not selected? I know you can set the text-color for the TabLayout by doing: setTabTextColors
How to set unselected Text Color for TabLayout.Tab - Android
Asked Answered
Why don't you give default color to text and change it on selection? –
Westnorthwest
Use app:tabTextColor
for default tab color and app:tabSelectedTextColor
for selected tab color.
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabTextColor="#000000"
app:tabSelectedTextColor="#FFFFFF"/>
You can use style
:
Add in styles.xml
:
<style name="CustomTabLayout" parent="Widget.Design.TabLayout">
<item name="tabTextColor">@color/default_text_color</item>
</style>
use in xml
<android.support.design.widget.TabLayout
style="@style/CustomTabLayout"
/>
© 2022 - 2024 — McMap. All rights reserved.