iOS Question Textview padding - left and right

MikeH

Well-Known Member
Licensed User
Longtime User
Following on from this:

How could I also have right padding?

I would like padding = "10, 0, 60, 0"

Thank you :)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Try this:
B4X:
Sub SetPadding(tf As TextField, PaddingLeft As Float, PaddingRight As Float)
   Dim pnlLeft As B4XView = XUI.CreatePanel("")
   pnlLeft .SetLayoutAnimated(0, 0, 0, PaddingLeft , tf.Height)
   Dim pnlRight As B4XView = XUI.CreatePanel("")
   pnlRight .SetLayoutAnimated(0, 0, 0, PaddingRight, tf.Height)
   Dim no As NativeObject = tf
   no.SetField("leftView", pnlLeft )
   no.SetField("leftViewMode", 3)
   no.SetField("rightView", pnlRight)
   no.SetField("rightViewMode", 3)
End Sub
 
Upvote 0

MikeH

Well-Known Member
Licensed User
Longtime User
Works perfectly, thanks Erel :)
 
Upvote 0
Top