How to change programmatically background color of action bar items

后端 未结 3 1757
生来不讨喜
生来不讨喜 2021-01-12 06:45

It is easy to set a default color of the items background in action bar by setting:

@drawable/action_bar         


        
3条回答
  •  爱一瞬间的悲伤
    2021-01-12 06:59

    Have you tried the solution from user3225831 mentioned here: https://stackoverflow.com/a/21297231/1738838

    ActionBar bar = getActionBar();
    bar.setBackgroundDrawable(new ColorDrawable("COLOR")); 
    

提交回复
热议问题