How to change dialog background color programmatically?

前端 未结 5 1838
栀梦
栀梦 2020-12-08 16:30

I have a main activity where users can change (via preferences) the background colour to their favourite colour. My problem is that I can not change the background colour o

5条回答
  •  一向
    一向 (楼主)
    2020-12-08 16:40

    I found a one rule solution!

    d.getWindow().setBackgroundDrawableResource(R.drawable.menubackground);
    

    It works for me with a normal dialog. But I dont know if it works on an AlertDialog.

提交回复
热议问题