Set Android Theme.Light for Alert Dialog

前端 未结 5 799
[愿得一人]
[愿得一人] 2021-02-12 03:50

I am trying to set the android Theme.Light theme for my alert dialog, but with no success so far. After reading a few tutorials I gathered that using Al

相关标签:
5条回答
  • 2021-02-12 03:59

    This took me a while to figure out as well.

    The issue at hand is that Theme.Light and Theme.Holo.Light and such are designed around the activity. A dialog theme needs to be based around a theme such as @android:style/Theme.Dialog which contains properties specific to dialogs.

    <style name="popup_theme" parent="@android:style/Theme.Dialog">
    

    Try overriding the Theme.Dialog using things like:

    <item name="android:textAppearance">?android:attr/textAppearanceInverse</item>
    
    0 讨论(0)
  • 2021-02-12 04:02
    parent="android:style/Theme.Light"
    
    0 讨论(0)
  • 2021-02-12 04:04

    Try this:

    <style name="popup_theme" parent="Theme.AppCompat.Light.Dialog.Alert">
    
    0 讨论(0)
  • 2021-02-12 04:05

    This is what I did. And it worked for me

    AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.Theme_AppCompat_Light_Dialog);
    
    0 讨论(0)
  • 2021-02-12 04:12

    change parent="android:Theme.Light" to parent="@android:style/Theme.Light"

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