Android Question Custom Font on "OK" Button with MsgboxAsync

Brandsum

Well-Known Member
Licensed User
Follow this https://www.b4x.com/android/forum/t...-whole-application-without-any-library.99933/

Then add this to your theme.xml manifest:
Button style:
B4X:
<style name="ButtonStyle" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog">
        <item name="android:textColor">#ff0aaa92</item>
        <item name="android:textSize">14dp</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textAllCaps">true</item>
</style>
Title style:
B4X:
<style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
        <item name="android:textSize">18dp</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textAllCaps">true</item>
        <item name="android:gravity">center_vertical</item>
        <item name="android:fontFamily">@font/CustomFontStyle</item>
        <item name="fontFamily">@font/CustomFontStyle</item>
</style>
Alert dialog style:
B4X:
<style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
        <item name="android:buttonBarNegativeButtonStyle">@style/ButtonStyle</item>
        <item name="android:buttonBarPositiveButtonStyle">@style/ButtonStyle</item>
        <item name="android:buttonBarNeutralButtonStyle">@style/ButtonStyle</item>
        <item name="android:windowTitleStyle">@style/Toolbar.TitleText</item>
        <item name="android:textSize">14dp</item>
        <item name="android:textAllCaps">false</item>
        <item name="android:fontFamily">@font/CustomFontStyle</item>
        <item name="fontFamily">@font/CustomFontStyle</item>
</style>
Then add this line to your custom theme,
B4X:
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
        ....
        <item name="android:alertDialogTheme">@style/AlertDialogTheme</item>
        ....
</style>
 
Upvote 0

DawningTruth

Active Member
Licensed User
Follow this https://www.b4x.com/android/forum/t...-whole-application-without-any-library.99933/

Then add this to your theme.xml manifest:
Button style:
B4X:
<style name="ButtonStyle" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog">
        <item name="android:textColor">#ff0aaa92</item>
        <item name="android:textSize">14dp</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textAllCaps">true</item>
</style>
Title style:
B4X:
<style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
        <item name="android:textSize">18dp</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textAllCaps">true</item>
        <item name="android:gravity">center_vertical</item>
        <item name="android:fontFamily">@font/CustomFontStyle</item>
        <item name="fontFamily">@font/CustomFontStyle</item>
</style>
Alert dialog style:
B4X:
<style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
        <item name="android:buttonBarNegativeButtonStyle">@style/ButtonStyle</item>
        <item name="android:buttonBarPositiveButtonStyle">@style/ButtonStyle</item>
        <item name="android:buttonBarNeutralButtonStyle">@style/ButtonStyle</item>
        <item name="android:windowTitleStyle">@style/Toolbar.TitleText</item>
        <item name="android:textSize">14dp</item>
        <item name="android:textAllCaps">false</item>
        <item name="android:fontFamily">@font/CustomFontStyle</item>
        <item name="fontFamily">@font/CustomFontStyle</item>
</style>
Then add this line to your custom theme,
B4X:
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
        ....
        <item name="android:alertDialogTheme">@style/AlertDialogTheme</item>
        ....
</style>
Thx Brandsum :)
 
Upvote 0
Top