Search code examples
androidandroid-actionbarandroid-toolbar

Wrong direction of back arrow on toolbar


I need supporting RTL languages on my application , problem is with back arrow on some devices specially samsung galaxy note 4. there is no problem on other devices so far but on note 4. how can I change the direction on this device also? this is how I do:

on manifest :

android:supportsRtl="true"

library : I am using appcompatV7(latest one)

drawable folder: I added all folders from support library version 4 like drawable-ldrtl-xxxhdpi

drawable: I am using android provided abc_ic_ab_back_mtrl_am_alpha.png in every single drawable folder

code :

    if(Build.VERSION.SDK_INT>17)
    mToolBar.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);

also I added this : getSupportActionBar().setHomeAsUpIndicator(R.drawable.abc_ic_ab_back_mtrl_am_alpha);

also in my style.xml there is :

    <item name="homeAsUpIndicator">@drawable/abc_ic_ab_back_mtrl_am_alpha</item>

With all of this, back arrow direction is ok on all devices so far except samsung galaxy note 4! Attached image is output on samsung note 4 which is wrong and back arrow should point to right instead of left can somebody please help on this

wrong direction! should point to right not left regards


Solution

  • finally fixed this by using this line of code :

    getSupportActionBar().setHomeAsUpIndicator(R.drawable.back_arrow)