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?
 

Erel

Administrator
Staff member
Licensed User
1. Never use Msgbox. Only MsgboxAsync (I've fixed it in the tutorial).
2. If you post code as a screenshot it will not help as it is not possible to copy it.
 

DawningTruth

Active Member
Licensed User
1. Never use Msgbox. Only MsgboxAsync (I've fixed it in the tutorial).
2. If you post code as a screenshot it will not help as it is not possible to copy it.
Erel, thx for the guidance. Will remember for future posts.
 

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.
 

DonManfred

Expert
Licensed 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:

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?
 
Top