mhany
mhany

Reputation: 73

Android Application force RTL

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

Answers (1)

Gugelhupf
Gugelhupf

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

Related Questions