Android Question Change the color of a text progressively

klaus

Expert
Licensed User
Longtime User
Different points:
- TextSize is a Float and not an Int, Private mTextSize As Int > Private mTextSize As Float

- Why are you using absolute pixels for the text coordinates X_CnvText = 50 : Y_CnvText = 50 ?
These coordinates must be calculated depending on the text size !

- You don't need to define an instance for pnlTextBack.
You can replace this
pnlTextBack.Initialize("pnlTextBack")
Base.AddView(pnlTextBack, 0, 0, Base.Width, Base.Height)

by this, use directly Base.
pnlTextBack = Base

- The problem with the resizing is that the mTextSize variable is not scaled by the Scale module (with AutoScale in the Designer it wouldn't have been resized eiher).
To make sure that the text size and other Label properties are updated and scaled you should use an invisible Label taking over the properties of the lbl Label in the DesignerCreateView routine.
lblDummy = lbl
Base.AddView(lblDummy, 0, 0, Base.Width, Base.Height)
lblDummy.Visible = False

and use everywhere lblDummy.TextSize instead of mTextSize.

You should add the other 'standard' Label properties to your CustomView.

Your CustomView can only be added in the Designer not in the code.

Attached you find a modified version of project T3.
 

Attachments

  • T4.zip
    13.3 KB · Views: 253
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…