Android Question How to set a designer script by code at runtime?

Mattiaf

Active Member
Licensed User
Is it possible to set the following script

B4X:
EditText.SetTopAndBottom(Label1.Bottom,button1.Top)

at runtime by pressing a button? Thanks
 
Solution
B4X:
Public Sub SetRelTopBottom(AnimDuration As Int, ViewToResize As B4XView, ViewTop As B4XView, ViewBottom As B4XView)
    ViewToResize.SetLayoutAnimated(AnimDuration, ViewToResize.Left, ViewTop.Top + ViewTop.Height, ViewToResize.Width, ViewBottom.Top -(ViewTop.Top + ViewTop.Height))
End Sub

1.gif

Mattiaf

Active Member
Licensed User
B4X:
Public Sub SetRelTopBottom(AnimDuration As Int, ViewToResize As B4XView, ViewTop As B4XView, ViewBottom As B4XView)
    ViewToResize.SetLayoutAnimated(AnimDuration, ViewToResize.Left, ViewTop.Top + ViewTop.Height, ViewToResize.Width, ViewBottom.Top -(ViewTop.Top + ViewTop.Height))
End Sub

View attachment 136407
hmm what are you putting inside the button Resize?
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
You have to put the Sub from @LucaMs in your code.
Then you will call your resize from any point like this
B4X:
SetRelTopBottom(0, EditText, Label1, Button1)
The first parameter (0 in my example) is the duration in milliseconds of the resize animation.
0 it's without animation.
 
Upvote 0
Top