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.
Thanks
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
We must believe a powerful rule in programming:
So, from now you can use this library to truly RTLize your actionbars: https://github.com/semsamot/ActionBarRTLizer
And of course it is compatible with API Level 7+ .
Booger is right. The "Nabz Bazar" app that you mentioned does not align to the right on every version of android. As you can see here ABS doesn't really do anything on Android 4.0 or newer and the screenshots of that app are on a 4.2 android.
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() methodforceRTLIfSupported();
and then insert the follow function into your Activity.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.
I am pretty sure you will not be able to do what you are asking. The ActionBar pattern is very specific, and the libraries supporting it would support the defined pattern only (which is having the icon on the top-left, then laying out title, and action buttons to the right).
Changing the test is as simple as changing the locale and text within your app (as you already alluded to).
Changing the position of the elements within the ActionBar itself will not be supported by the libraries that support the standard ActionBar pattern - as what you describe is not a supported UI pattern.
I think you should leave the AB as-is. It is not necessary to switch the order, as there is no right-left orientation anyway -and changing this will be extremely jarring to your users.
Bottom line, you won't be able to to this with the existing libraries - and you probably shouldn't anyway.
use this, It will be make layout from rtl but this in parent root of your xml