Android Code Snippet Text justify for RTL languages

Requested on THIS post,I found a github project HERE to resolve this issue.You can download the library from THERE.

How to use it.

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim From As String
    Private RTLJustify1 As RTLJustifyTextView
    Dim sv As ScrollView
    Private btn1 As Button
    Private btn2 As Button
    Private Panel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example
    sv.Initialize(1900dip)
    Activity.AddView(sv,0,0,100%x,100%y)
    sv.Panel.LoadLayout("Layout1")
    sv.Panel.Height = Panel1.Height
    From = File.ReadString(File.DirAssets, "Arabic-Lipsum.txt")
    RTLJustify1.SetText(From,False)
    RTLJustify1.DrawingCacheEnabled = True   
    RTLJustify1.TextColor = Colors.Blue
    RTLJustify1.TextGravity = RTLJustify1.GRAVITY_FILL_VERTICAL
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub btn2_Click
    RTLJustify1.SetText(From,False)
End Sub
Sub btn1_Click
    RTLJustify1.SetText(From,True)
End Sub
 
Top