solnaranu
solnaranu

Reputation: 41

Android override Theme.Dialog windowTitleStyle property for AlertDialog.Builder

I'm using AlertDialog.Builder like this:

ContextThemeWrapper cw = new ContextThemeWrapper(context, R.style.AlertDialogTheme);
AlertDialog.Builder builder = new AlertDialog.Builder(cw);

This is my custom AlertDialogTheme style:

<style name="AlertDialogTheme" parent="@android:Theme.Dialog">
    <item name="android:textSize">15sp</item>
    <item name="android:windowTitleStyle">@style/custom_style</item>
</style>    

The textSize attribute works fine for the list of items I put in the builder with builder.setItems(), but it doesn't work on the title, so I've tried to override the windowTitleStyle attribute, but it doesn't work.

Is it even possible or am I doing something wrong?

Upvotes: 3

Views: 1221

Answers (1)

Dave Morgan
Dave Morgan

Reputation: 429

I'm having similar issues, and I've done just what you have. One thing to note is that windowTitleStyle isn't used in the dialog title before API 14. Before that it was textAppearanceMedium. And in the default (pre-holo) dialog it is textAppearanceLarge.

Unfortunately, I'm setting all three of these to my custom style and testing in KK, but it still doesn't update the color as I'm expecting.

Upvotes: 2

Related Questions