change action bar direction to right-to-left Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of change action bar direction to right-to-left without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I’m creating an android app for a right-to-left specific language. And I’m using ActionBarSherlock (a compatible android action bar library).
The thing I exactly want is how to change the direction of action bar to RTL even the user not sets the default Locale an RTL language.
If anyone has an idea even for standard android Action Bar it’s valuable and may help please share it.


From Android API Level 17+ it supports RTL natively. To force your entire layout to be RTL including the ActionBar do the following.

Edit your AndroidManifest.xml and add android:supportsRtl="true" to your <application> tag and then add the following line to the top of your Activities’ onCreate() method forceRTLIfSupported(); and then insert the follow function into your Activity.

private void forceRTLIfSupported()

Of course that’s only helpful for debugging. Use View.LAYOUT_DIRECTION_LOCALE for production builds so your layout is only changed when the user chosen system location/language aka locale supports RTL.

Hope that helps.

We are here to answer your question about change action bar direction to right-to-left - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji