Reputation: 73
I need to force my application to run RTL regardless the phone language it can be done by Developer mode and i need it be added programatically to the application to force the application display to rtl
android:supportsRtl="true"
this working depend on phone languages Thanks
Upvotes: 5
Views: 2169
Reputation: 970
Set the language of your app on startup like :
Resources res = getResources();
Configuration newConfig = new Configuration( res.getConfiguration() );
Locale locale = new Locale( appLanguage );
newConfig.locale = locale;
newConfig.setLayoutDirection( locale );
res.updateConfiguration( newConfig, null );
setLayoutDirection is important in case your appLanguage is differ from the Phone language.
Upvotes: 7