Light theme for AlertDialog?

前端 未结 1 1282
迷失自我
迷失自我 2021-01-17 20:36

I\'m creating an AlertDialog. I\'m using setView() to set a custom view. This enables the \'dark\' theme on the dialog (grey background, and need white text).

Is the

1条回答
  •  爱一瞬间的悲伤
    2021-01-17 20:42

    Steps I took:

    • Create a class extending Dialog.
    • In the onCreate, call setContentView(x, y) with x being your R.layout and y being R.style.popupStyle (see below).
    • In your res/values/style.xml, you need to override the default DialogWindow style. I tried just making a style that has this one as its parent, but that still didn't clear all defaults. So I checked the Android git tree and got the default style, and just copy-pasted it. This is the one

    :

    
    

    You'll get a few errors, just solve them by copying more stuff from the official Android styles.xml and themes.xml files.

    for reference: styles.xml and themes.xml.

    0 讨论(0)
提交回复
热议问题