Change button color in AlertDialog

后端 未结 16 2350

How can I change the color of the button(s) in an AlertDialog in Android?

16条回答
  •  臣服心动
    2020-12-02 22:52

    Are you referring to the neutral, positive and negative buttons? Or to buttons you included in the layout?

    If you are referring to the former, then yes you can. Check out the Custom Button section in this tutorial. You basically need an XML file that will tell your button which drawable/color to use for each state change. You can then set this XML file as your button's background.

提交回复
热议问题