Android Question setlinespace method with java object

ArminKH

Well-Known Member
hi this is my first question in forum
i use this method with reflection 4 set line space

Dim RE As Reflector
RE.Target=MyView
RE.RunMethod3("setLineSpacing",1,"java.lang.float",1.5,"java.lang.float")

1-is there any way to use this method with java object?(how ?)because i use java object always and i dont want use 2 library
2-this method has 2 argument in this example argument 1 is 1 and argument 2 in 1.5
but we set line space with one number what is the first argument ?
3-is there any way to get line spacing?

plz help
 
Last edited:

klaus

Expert
Licensed User
Longtime User
1) Routine with JavaObject:
B4X:
'Sets the line spacing
'lbl = TextView
'Add = number of extra pixels to add
'Multiplier = multiplier factor of spacing
Sub SetLineSpacing(lbl As Label, Add As Float, Multiplier As Float)
   Dim jo = lbl As JavaObject
   jo.RunMethod("setLineSpacing", Array As Object(Add, Multiplier))
End Sub

2) First parameter Add, number of extra pixels to add
Second parameter Multiplier, multiplier factor

3) Routines to get the line spacing.
B4X:
'Gets the extra pixels of line spacing
Sub GetLineSpacingExtra(lbl As Label) As Float
    Dim jo = lbl As JavaObject
    Return jo.RunMethod("getLineSpacingExtra", Null)
End Sub

'Gets the multiplier factor of line spacing
Sub GetLineSpacingMultiplier(lbl As Label) As Float
    Dim jo = lbl As JavaObject
    Return jo.RunMethod("getLineSpacingMultiplier", Null)
End Sub
 
Upvote 0

ArminKH

Well-Known Member
Tnx 4 your quick answer klaus
SOLVED
 
Last edited:
Upvote 0
Top