How can I change entire app layout direction to RTL?
I am writing an app that user must select it's language in first launch and the layout should change based on user selection to RTL or remains LTR.
I used to add android:supportsRtl="true"
to the AndroidManifest
and android:layoutDirection="rtl"
for each layout but this approach have some problems like below :
One problem is when I change the direction to RTL the ActionBar
home icon or navigation button (when home as up is enabled) remains LRT and just move to the right.
I also tried to change direction programmatically and the result was the same :
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1){
getWindows().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
}
Is there any way to force all activities to become RTL at once or we should set direction in each activity separately?
values
,values-de
,values-es
,values-fr
,values-it
, etc). The language set on the user's device would be automatically detected, and the correct strings/text would be displayed for that language. As well as this, the LTR or RTL layouts would be adjusted accordingly for that language. – Marigolda