Android Question Change the color of a text progressively

LucaMs

Expert
Licensed User
Longtime User
I started to develop a custom view to achieve this:
Untitled.gif


I would like to know if it already exists.

In addition, I will ask someone for help (I do not write but I have some names in mind :)) since beginning to get tired :D.
 

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: 174
Upvote 0
Top