SoFunction
Updated on 2025-04-09

Android AlertDialog custom style implementation code

Android AlertDialog Custom Style

Pop-up dialog boxes for selections like lists, if you want to change the style, you usually rewrite the layout method.

I just learned today that you can actually customize the style. I will share it with you. It is actually very simple

 builder = new (new ContextThemeWrapper(this, )); 



Then customize your own style



<?xml version="1.0" encoding="utf-8"?> 
<resources> 
  <style name="AlertDialogCustom" parent="@android:style/AlertDialog"> 
    <item name="android:textColor">#00FF00</item> 
    <item name="android:typeface">monospace</item> 
    <item name="android:textSize">10sp</item> 
  </style> 
</resources> 



Thank you for reading, I hope it can help you. Thank you for your support for this site!