Android Question Rotating view around center

Star-Dust

Expert
Licensed User
Longtime User
You have to set the rotation point (the pivot)

B4X:
'reference upper left corner, default pivot middle of the view
Sub setPivot(v As View, X As Float, y As Float)
    Dim j  As JavaObject = v
    j.RunMethod("setPivotX", Array As Object(X))
    j.RunMethod("setPivotY", Array As Object(Y))
End Sub

Or
B4X:
Sub setPivotCenter(v As View)
    Dim j As JavaObject = v
    Dim X As Float = v.Width / 2
    Dim y As Float = v.Height / 2
    j.RunMethod("setPivotX", Array As Object(X))
    j.RunMethod("setPivotY", Array As Object(Y))
End Sub
 
Last edited:
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
I use it to create effects in views (panels, labels and others).


Thank you Klaus
 
Last edited:
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
very nice StarDust

 
Upvote 0
Top