Question

Background

I've made an "app manager" alternative app, and I wish to add translation for RTL (right to left) languages.

Since I know that as of certain Android version, things got flipped to let words and sentences align correctly, I decided to first switch to such a language and then continue with the translation

The problem

After switching to an RTL language (Hebrew in my case), I've found out that the action bar's up button has the "<" image flipped horizontally:

enter image description here

So now it shows ">" instead.

The question

How do I fix it? It doesn't make sense to see it this way...

Was it helpful?

Solution 2

Well, you can access that ActionBar "up" affordance by calling Resources.getIdentifier and View.findViewById. After that you could rotate it.

    final int upId = getResources().getIdentifier("up", "id", "android");
    final View up = findViewById(upId);
    // Call this to just rotate the icon 180°
    if (getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
        up.setRotation(180f);
    }

OTHER TIPS

What worked for me was to let the system use the default theme, and not specify Holo. If you can live with that, the Up button will be oriented correctly. Unfortunately this cannot be done if you use AppCompat of course. To make this even more annoying: the flipping of the up button is device specific. It occurs on Samsung devices but not on Google's. The supportsRtl flag is only for API 17 and above, so older Samsung phones cannot be fixed. The issue is apparently the Holo implementation on Samsung devices. Be careful with flipping the icon since on Google phones it will be flipped wrong.

See this: https://code.google.com/p/android/issues/detail?id=68476

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top