B4J Question [B4X] SetLayoutAnimated float instead of double

Alexander Stolte

Expert
Licensed User
Longtime User
my view is not centered and the problem is that the types of "SetLayoutAnimated" is double.
B4X:
xpnl_background.Height/2 - (xpnl_background.Height/1.5)/2
13.333333015441895 'Float
13.333333333333334 'Double
How can i change the double to float?
 

LucaMs

Expert
Licensed User
Longtime User
Your problem can't be that,
13.333333015441895 dip
or
13.333333333333334 dip
are the same.

To center a View vertically to you need to use the height of the View and the height of its containter (parent)
B4X:
' Centers horizontally too.
Button1.SetLayoutAnimated(500, (Pane1.Width - Button1.Width) / 2, (Pane1.Height - Button1.Height) / 2, Button1.Width, Button1.Height)
 
Last edited:
Upvote 0
Top