Android Question Differences between how views are added

Discussion in 'Android Questions' started by agraham, Jul 1, 2019.

  1. agraham

    agraham Expert Licensed 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?
     
  2. agraham

    agraham Expert Licensed 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?

    Code:
    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 :(
     
  3. DonManfred

    DonManfred Expert Licensed User

    But great you got it sorted ;-)
     
    agraham likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice