U unba1300 Guest Jan 19, 2014 #1 Is it possible to add padding at the end of an edittext? My edittexts look like torn pieces of paper and I'd like to add a pushpin (PNG image) near the right edge, but it currently covers the text, so that's why I'm wondering about padding or something. I don't think limiting the number characters would work because that would vary too much between different devices. Thanks.
Is it possible to add padding at the end of an edittext? My edittexts look like torn pieces of paper and I'd like to add a pushpin (PNG image) near the right edge, but it currently covers the text, so that's why I'm wondering about padding or something. I don't think limiting the number characters would work because that would vary too much between different devices. Thanks.
Erel B4X founder Staff member Licensed User Longtime User Jan 20, 2014 #2 You can set the padding of any view with this code: Code: Copy Sub SetPadding(v As View, Left As Int, Top As Int, Right As Int, Bottom As Int) Dim jo As JavaObject = v jo.RunMethod("setPadding", Array As Object(Left, Top, Right, Bottom)) End Sub Upvote 1
You can set the padding of any view with this code: Code: Copy Sub SetPadding(v As View, Left As Int, Top As Int, Right As Int, Bottom As Int) Dim jo As JavaObject = v jo.RunMethod("setPadding", Array As Object(Left, Top, Right, Bottom)) End Sub
U unba1300 Guest Jan 20, 2014 #3 Thank you. I padded the edittexts on the right edge the same width as an enabled, but transparent, label, and have the labels' click event change the position a pushpin to match. Looks and feels quite nice. Upvote 0
Thank you. I padded the edittexts on the right edge the same width as an enabled, but transparent, label, and have the labels' click event change the position a pushpin to match. Looks and feels quite nice.
mangojack Expert Licensed User Longtime User Apr 22, 2014 #4 Try this .. requires reference to JavaObject library. Code: Copy Sub DoPadding For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Button Then Dim b As Button b = Activity.GetView(i) Dim jo As JavaObject = b jo.RunMethod("setPadding", Array As Object(0, 0, 0, 10)) End If Next End Sub Upvote 0
Try this .. requires reference to JavaObject library. Code: Copy Sub DoPadding For i = 0 To Activity.NumberOfViews - 1 If Activity.GetView(i) Is Button Then Dim b As Button b = Activity.GetView(i) Dim jo As JavaObject = b jo.RunMethod("setPadding", Array As Object(0, 0, 0, 10)) End If Next End Sub
Erel B4X founder Staff member Licensed User Longtime User Apr 22, 2014 #5 A slightly better routine that handles all views including nested views: Code: Copy For Each v As View in Activity.GetAllViewsRecursive If v Is Button Then Dim jo As JavaObject = v jo.RunMethod("setPadding", ArrayAsObject(0, 0, 0, 10dip)) End If Next Upvote 0
A slightly better routine that handles all views including nested views: Code: Copy For Each v As View in Activity.GetAllViewsRecursive If v Is Button Then Dim jo As JavaObject = v jo.RunMethod("setPadding", ArrayAsObject(0, 0, 0, 10dip)) End If Next
Erel B4X founder Staff member Licensed User Longtime User Apr 23, 2014 #6 The padding determines the empty space kept between the text and the borders. Use smaller values if you want to show more text. Upvote 0
The padding determines the empty space kept between the text and the borders. Use smaller values if you want to show more text.