How do you change TabPageIndicator's color in standard style?



  • I'll use it. <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    minSdkVersion 16
    targetSdkVersion 22
    

    That's a way to change the thickness of the Indicator and its color. How do you do that with style?

    введите сюда описание изображения

    For now, I'm in style.

    <resources>
    
    &lt;!-- Base application theme. --&gt;
    &lt;style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"&gt;
    
        &lt;!-- Customize your theme here. --&gt;
        &lt;item name="actionBarStyle"&gt;@style/MyActionBar&lt;/item&gt;
        &lt;item name="actionBarTabBarStyle"&gt;@style/ActionBarTabStyle&lt;/item&gt;
    &lt;/style&gt;
    
    &lt;style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar"&gt;
        &lt;item name="background"&gt;@color/BackgroundColorActionBar&lt;/item&gt;
        &lt;item name="android:titleTextStyle"&gt;@style/MyTitleTextStyle&lt;/item&gt;
    &lt;/style&gt;
    
    &lt;style name="MyTitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"&gt;
        &lt;item name="android:textColor"&gt;@color/White&lt;/item&gt;
    &lt;/style&gt;
    
    &lt;style name="ActionBarTabStyle" parent="@style/Widget.AppCompat.ActionBar.TabView"&gt;
        &lt;item name="android:background"&gt;@color/BackgroundColorTabActionBar&lt;/item&gt;
    &lt;/style&gt;
    

    </resources>

    Here's thelips.

    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.0'



  • You can try to create one. style:

    <style name="MyTabWidgetStyle" parent="Base.Widget.Design.TabLayout">
        <item name="tabIndicatorColor">@color/targetColor</item>
        <item name="tabIndicatorHeight">1dp</item>
    </style>
    

    and stick it in. TabLayout

    <android.support.design.widget.TabLayout
        ...
        style="@style/MyTabWidgetStyle"
    />
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2