Changing ActionBar tabs underline color programmatically

后端 未结 8 1898
误落风尘
误落风尘 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:34

    Here is a much easier way. I know you were looking for a programmatic change, but this one is REALLY easy.

    I've been struggling with this for days, but finally found the solution. I'm using AppCompat. You can set colorAccent in your theme and that will change the highlight color on your ActionBar. Like so:

    @color/highlightcolor
    

    Here it is in context:

    
    

    Where I originally posted this answer: Android Tab underline color not changing

提交回复
热议问题