Android: ConstraintLayout supports RTL

I went through many decisions, but I did not understand how to make RTL design support. Using ConstraintLayout in android.

+5
source share
2 answers

Just replace the restrictions from Left to Start and Right to End ,

 app:layout_constraintLeft_toRightOf = layout_constraintStart_toEndOf app:layout_constraintRight_toLeftOf = layout_constraintEnd_toStartOf app:layout_constraintLeft_toLeftOf = layout_constraintStart_toStartOf app:layout_constraintRight_toRightOf = layout_constraintEnd_toEndOf 

I'm sure it’s perfect for you,

See my paradigm item_list.xml

LTR Screenshot

English

Screenshot RTL

RTL

Note. I hope you already added this android:supportsRtl="true" in AndroidManifest.xml , and some of them you need to remove the textAlignment property. Alignment will certainly work with the text Arabic .

+14
source

Follow these steps:

  • Find and replace Left with Start
  • Find and replace Right with End

If you use leftDrawing or rightDrawing , you still need to replace it with startDrawing and endDrawing

Same thing to fill in,

and don't forget to add the following line to the AndroidManifest file,

 android:supportsRtl="true" 
+1
source

Source: https://habr.com/ru/post/1271689/


All Articles