How to change theme for AlertDialog

前端 未结 15 2066
名媛妹妹
名媛妹妹 2020-11-22 09:14

I was wondering if someone could help me out. I am trying to create a custom AlertDialog. In order to do this, I added the following line of code in styles.xml



        
15条回答
  •  一整个雨季
    2020-11-22 09:30

    Arve Waltin's solution looks good, although I haven't tested it yet. There is another solution in case you have trouble getting that to work.... Extend AlertDialog.Builder and override all the methods (eg. setText, setTitle, setView, etc) to not set the actual Dialog's text/title/view, but to create a new view within the Dialog's View do everything in there. Then you are free to style everything as you please.

    To clarify, as far as the parent class is concerned, the View is set, and nothing else.

    As far as your custom extended class is concerned, everything is done within that view.

提交回复
热议问题