Reputation: 220
trying to set the layout elements to be RTL ordered
in 4.2 and above the line: layoutDirection="rtl"
and in the manifest: android:supportsRtl="true"
is working just fine.
but for below 4.2 its not.
solution anyone ?
Upvotes: 14
Views: 9899
Reputation: 19
you can change your application language and solve this problem :
String languageToLoad = "en";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
Upvotes: 2
Reputation: 774
Just use ViewCompat using android.support.v4.view to do it.
ViewCompat.setLayoutDirection(findViewById(R.id.my_view), ViewCompat.LAYOUT_DIRECTION_RTL);
Upvotes: 24
Reputation: 36205
You won't be able to. It was added to in API Level 17 which is 4.2 so the older versions do not support it.
Upvotes: 6