0

I searched google but can not find solution.I need to define different styles for Tablayout for themes.I figure it out how to include my Toolbar style but can not make it work because of Base.Widget.Design.TabLayout.When I define it as a name it works but I can only use it for one style.When I define it as parent and include it to my theme with android:tabWidgetStyle it does not work

As a parent(which does not work)

<style name="tabayout" parent="Base.Widget.Design.TabLayout">
        <item name="tabSelectedTextColor">@color/white</item>
        <item name="tabIndicatorColor">@color/deep_orange_300_colorAccent</item>
        <item name="tabBackground">@color/deep_orange_300_colorAccent</item>
    </style>

Second(which works but I can only use it once, but I need to define 14 style)

<style name="Base.Widget.Design.TabLayout" parent="android:Widget">
        <item name="tabSelectedTextColor">@color/white</item>
        <item name="tabIndicatorColor">@color/red_200_colorAccent</item>
        <item name="tabBackground">@color/red_200_colorAccent</item>
        <item name="tabTextColor">@color/red_200_colorPrimaryDark</item>
    </style>

Edit

I want to style TabLayout for specific custom theme.I want to make Toolbar background textColor etc for chosen colour by user. So I used Base.Widget.Design.TabLayout as a name to style TabLayout and include it with android:tabWidgetStyle it worked.But when I use it as parent it does not work.Here My Theme

This works.But when I define Base.Widget.Design.TabLayout as a parent it does not work.

<style name="AppTheme_red_200" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/red_200_colorPrimary</item>
        <item name="colorPrimaryDark">@color/red_200_colorPrimaryDark</item>
        <item name="colorAccent">@color/red_200_colorAccent</item>
        <item name="android:tabWidgetStyle">@style/Base.Widget.Design.TabLayout</item>
        <item name="android:textColor">@color/red_400_colorPrimaryDark</item>
    </style>

    <style name="Base.Widget.Design.TabLayout" parent="">
        <item name="tabSelectedTextColor">@color/white</item>
        <item name="tabIndicatorColor">@color/red_200_colorAccent</item>
        <item name="tabBackground">@color/red_200_colorAccent</item>
        <item name="tabTextColor">@color/red_200_colorPrimaryDark</item>
    </style>
Gulshan
  • 61
  • 1
  • 10

0 Answers0