جاستیفای کردن متن مخصوص زبانهای RTL راست به چپ مانند فارسی و عربی

برای جلوگیری از نامنظم بودن متن در یک ویو باید آن را جاستیفای کرد.

که برای فارسی و عربی بسیار لازم می باشد.

دانلود سورس
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

مرجع گیت هاب
https://github.com/Saleh-Hassan/RTL-TextJustify-Android
تاپیک در سایت مرجع
https://www.b4x.com/android/forum/threads/text-justify-for-rtl-languages.72189/#post-459114

دیدگاهتان را بنویسید