1

I have an AlertDialog with buttons which I'd like to set to bold. I find the default style to be very thin:

enter image description here

but when I set the style as such:

<style name="DialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:textColorPrimary">@color/gray_dark</item>
    <item name="colorAccent">@color/blue</item>
    <item name="android:buttonStyle">@style/buttonStyle</item>
</style>

<style name="buttonStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
    <item name="android:textStyle">bold</item>
</style>

I find the result to be, erhm, much bolder than I'd like:

enter image description here

I was aiming for something like this:

enter image description here

The screenshot is from WhatsApp. Are they using a different font or is it something I can replicate just by styling my XML file?

dekaru
  • 345
  • 2
  • 10

1 Answers1

0

Based on the answer here, it seems that the correct style for what I want to achieve is adding these lines to the button style:

<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textStyle">normal</item>

Now I have the wanted "not so bold" look!

Community
  • 1
  • 1
dekaru
  • 345
  • 2
  • 10