Android Question Custom Fonts for Message Boxes

DawningTruth

Active Member
Licensed User
My app has a particular look and feel which includes a custom font. When I use:

xui.Msgbox2Async

It uses the default font for the Modal Box.

Is there any way to change the font to be the same as the custom font of my app?
 

DawningTruth

Active Member
Licensed User
For anyone searching this thread, here is the direct link with the code:

https://www.b4x.com/android/forum/threads/charsequence-csbuilder-tutorial.76226/#content

ZVAPt8.jpg
 
Upvote 0

DawningTruth

Active Member
Licensed User
Tried with the following code:

B4X:
xui1.MsgboxAsync(csbuilder1.Initialize.Alignment("ALIGN_CENTER").Append($"My Message"$).Typeface(Typeface.LoadFromAssets("opensanscondensed-bold.ttf")).PopAll,"Message Title")

The body of the message should be in the Open Sans font and the Heading in the default font. However they are both in the default font.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The body of the message should be in the Open Sans font and the Heading in the default font. However they are both in the default font.
You are not using CSBuilder for the title.
l,"Message Title"

You are not using CS Builder correctly

B4X:
    MsgboxAsync(cs.Initialize.Typeface(Typeface.LoadFromAssets("opensanscondensed-bold.ttf")).Alignment("ALIGN_LEFT").Append($"Lorem ipsum dolor"$).PopAll, _
cs.Initialize.Typeface(Typeface.LoadFromAssets("opensanscondensed-bold.ttf")).Append("Test bla bla bla").PopAll)

in my case i was setting two fonts and both, title and body, does have a different font in the result.
 
Last edited:
Upvote 0

DawningTruth

Active Member
Licensed User
You are not using CSBuilder for the title.


You are not using CS Builder correctly

B4X:
    MsgboxAsync(cs.Initialize.Typeface(Typeface.LoadFromAssets("opensanscondensed-bold.ttf")).Alignment("ALIGN_LEFT").Append($"Lorem ipsum dolor"$).PopAll, _
cs.Initialize.Typeface(Typeface.LoadFromAssets("opensanscondensed-bold.ttf")).Append("Test bla bla bla").PopAll)

in my case i was setting two fonts and both, title and body, does have a different font
Thx Don, that worked perfectly.

Is there also a way to change the "Ok" to this font?
 
Upvote 0
Top