Android Question Differences between how views are added

agraham

Expert
Licensed User
Longtime User
There are obvious visual differences between Buttons and ToggleButtons added when defined in the Designer and added in a layout by LoadLayout() and when initialised programmatically and added by Activity.AddView.

For both types of view the Typefaces are different but unfortunately as Typefaces are effectively write-only it is not possible to inspect the difference. However setting the Typeface of a programmatically added view to a new Typeface created by Typeface.CreateNew(Typeface.DEFAULT, Typeface.STYLE_NORMAL) as the Designer does seems to match.

What I cannot match is that ToggleButton text is always capitalised on a programmatically added ToggleButton and despite poking around in Core.jar I can't see where the Designer manages to override this behaviour. Any ideas anyone?
 

agraham

Expert
Licensed User
Longtime User
Why does posting a question always act as a spur to finding the answer on your own - or at least in a web search?

B4X:
    Dim b As ToggleButton
    b.Initialize("ToggleButton")
    Dim jo As JavaObject = b
    jo.RunMethod("setAllCaps", Array As Object( False))
I've wasted hours on this :(
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top