I am trying to enlarge the text size on all of my applications dialog buttons via styles. The following code will change the buttons background colour and even the text case but for some reason the textSize item is not honoured:
<style name="MyAppTheme" parent="@android:style/Theme.Holo">
<item name="android:dialogTheme">@style/MyApp.Dialog</item>
<item name="android:alertDialogTheme">@style/MyApp.Dialog.Alert</item>
</style>
<style name="MyApp.Dialog" parent="@android:style/Theme.Holo.Dialog">
<item name="android:borderlessButtonStyle">@style/MyApp.BorderlessButton</item>
</style>
<style name="MyApp.Dialog.Alert" parent="@style/MyApp.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
</style>
<style name="MyApp.BorderlessButton" parent="@android:style/Widget.Holo.Button.Borderless">
<item name="android:textSize">50sp</item>
<item name="android:textAllCaps">true</item>
<item name="android:background">#800</item>
</style>
Why is the textSize not being read? What do I have to do to make it larger?
You are not assigning the right attribute here:
<style name="MyApp.Dialog" parent="@android:style/Theme.Holo.Dialog">
====> <item name="android:borderlessButtonStyle">@style/MyApp.BorderlessButton</item>
</style>
The attribute you need to use is:
android:buttonStyle
I propose the following change:
<style name="MyApp.Dialog" parent="@android:style/Theme.Holo.Dialog">
<item name="android:buttonStyle">@style/MyApp.BorderlessButton</item>
</style>
Why:
borderlessButtonStyle
is a conveniently defined style. But it isn't currently wired to any of the default attributes - in this case, buttonStyle
. You still need to assign it.
I can't figure out why the background
and textAllCaps
attributes come into effect. Posting your dialog's/alert dialog's xml might help. Also, how have you defined the string - "i agree" or "I AGREE"?