I started this BUG report on the assumption that it was the SetLayoutAnimated method that was the culprit of the removing of the Text Format, But after a small test, I discovered that a simple textsize change does it.
How to replicate:
In the visual designer, add a Label and set a few format Options, like Bold,Italic and size.
save the layout, and in the code, change the textsize property to a different value than the one you set in the visual designer... you'll find that that action has removed all the other formatting.
PS: I found that using the extra css property and set it to -fx-font-weight:bold; results in a bold text even after text resizing by code.
So I guess that tsyle appends/overrides the base styling, while textsize removes any non css style set propertiies
I used the following to "clone" a view (not rally cloning it but to be able to reference it)
B4X:
Dim Target as ImageView = Sender
Dim targetLabel As Label
MySelection = target.Tag
Select MySelection
Case "xpto"
targetLabel = Label1
Case ..."
End Select
y=target.Top
yl=targetLabel.Top - 5
target.SetLayoutAnimated(300,x,y,80,80)
targetLabel.SetLayoutAnimated(300,xl,yl,55,30)
targetLabel.TextSize = 14
I found that, even thou Label1 has font properties set to be Font Size =14 and BOLD ITALIC in style, these are not cloned into the targetLabel
Label1 is NOT the sender, I use the sender to be able to "know" which label I need to act upon, like, if the mouse goes over imageview1, I animate label1, if it goes over imageview2, I animate label2, and so on
This is a limitation of the internal Font API. It doesn't provide a method to get the current style. Changing the text style requires setting a new font and the style is lost.