01-22-2014، 01:06 PM
سلام با گشت و گذار فراوان دو تا كد پيدا كردم اما هنوز تست نكردم اگه كسي تست كرد لطف كن نمونه كارش بزاره
کد:
1. You can set the padding of any view with this code:
Code:
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
2. You can use the Reflection library to set the padding to a minimum value.
Try the following code:
Code:
Sub Globals
Dim txt1 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
txt1.Initialize("txt1")
Dim c As Canvas
Dim b As Bitmap
b.InitializeMutable(1, 10)
c.Initialize2(b)
txt1.Text = "Hello"
Dim size As Float
size = c.MeasureStringHeight(txt1.Text, txt1.Typeface, txt1.TextSize)
txt1.Gravity = Bit.Or(Gravity.TOP, Gravity.LEFT) 'Set gravity to top left
Activity.AddView(txt1, 10dip, 10dip, 100dip, size + 6dip)
txt1.Color = Colors.White 'Removes the view edges
Dim r As Reflector
r.Target = txt1
'Set padding to minimum
r.RunMethod4("setPadding", Array As Object(0, 1dip, 0, 0), _
Array As String("java.lang.int", "java.lang.int", "java.lang.int", "java.lang.int"))
End Sub