Changing ActionBar tabs underline color programmatically

后端 未结 8 1870
误落风尘
误落风尘 2020-12-01 18:28

I have created the action bar by

ActionBar actionbar = getActionBar()

The background of the action bar is changed by

acti         


        
相关标签:
8条回答
  • 2020-12-01 18:46

    Refer this, for customize action bar,

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <!-- the theme applied to the application or activity -->
        <style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
            <item name="android:actionBarStyle">@style/MyActionBar</item>
            <!-- other activity and action bar styles here -->
        </style>
    
        <!-- style for the action bar backgrounds -->
        <style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
            <item name="android:background">@drawable/ab_background</item>
            <item name="android:backgroundStacked">@drawable/ab_background</item>
            <item name="android:backgroundSplit">@drawable/ab_split_background</item>
        </style>
    </resources>
    
    0 讨论(0)
  • 2020-12-01 18:47

    you can use this code:

    actionBar.setStackedBackgroundDrawable(new ColorDrawable(yourColor));

    0 讨论(0)
提交回复
热议问题