How to change the background color of Action Bar's Option Menu in Android 4.2?

后端 未结 17 1338
别那么骄傲
别那么骄傲 2020-11-22 16:00

I\'d like to change the background color of the option (overflow) menu in Android 4.2. I have tried all the methods but it is still showing the default color set by the them

17条回答
  •  孤街浪徒
    2020-11-22 16:59

    I used this and it works just fine.

    Apply this code in the onCreate() function

    val actionBar: android.support.v7.app.ActionBar? = supportActionBar
        actionBar?.setBackgroundDrawable(ColorDrawable(Color.parseColor("Your color code here")))    
    

提交回复
热议问题