Home > Back-end >  how to set dark theme for Material Dialog android
how to set dark theme for Material Dialog android

Time:08-25

dialog xml

 <style name="Theme.MyApp.Dialog.Alert" parent="ThemeOverlay.Material3.MaterialAlertDialog">
    <item name="android:textColor">@color/md_theme_light_onBackground</item>
    <item name="android:background">@color/md_theme_light_background</item>
    

the missing attribute is the inner items color how to set it

enter image description here

CodePudding user response:

Define dialog in your styles.xml and do whatever modifications required here.

<style name="MyDialog" parent="Theme.Material3.Dark.Dialog.Alert"/>

And then in your code

AlertDialog.Builder(this, R.style.MyDialog)
  • Related