Custom (gradient) background of ActionBar Compat

后端 未结 4 1588
遥遥无期
遥遥无期 2021-02-05 13:59

I am using Action Bar Compat so that my action bar with navigation drawer was backward compatible down to API level 9 and I want to change the background of the action bar.

4条回答
  •  爱一瞬间的悲伤
    2021-02-05 14:43

    I am currently working on the same task.

    Here is my action_bar_bg.xml file in which I define the gradient for my action bar.

    
    
        
    
    

    DeadObjectException

    android:shape="line" can't be used if there is a gradient inside. I tested it; my Samsung Galaxy Note 10.1 N8000 restarted, and there was a DeadObjectException.

    The linear type of gradient pattern is the default value. So you don't have to declare it explicitly.

    Here is my styles.xml in the values folder.

    
    
        
        
    
        
    
        
        
    
    
    

    Gradient Drawable

提交回复
热议问题