Set LayoutDirection (RTL) for api lower than 17

后端 未结 2 1924
不思量自难忘°
不思量自难忘° 2020-12-14 15:32

I am going to build a Persian app (RTL). my app includes a ListView and a Navigation Drawer .

I added in Manifest in application tag

相关标签:
2条回答
  • 2020-12-14 16:15

    Just concatenate every string that you want to set in textView with "\u202B"

    it just enforces the text to be RTL.

    String textWhichIsLTR = "LTR or RTL text that you want to enforce to RTL";
    String enforcedRTL = textWhichIsLTR + "\u202B";
    fooTextView.setText(enforcedRTL);
    
    0 讨论(0)
  • 2020-12-14 16:26

    use ViewCompat from android.support.v4.view.ViewCompat !

    like this :

    ViewCompat.setLayoutDirection (View yourView, int layoutDirection)
    

    layoutDirection is a constant from ViewCompat class

    0 讨论(0)
提交回复
热议问题