Mahdi Giveie
Mahdi Giveie

Reputation: 640

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

Upvotes: 2

Views: 1780

Answers (2)

Mohammad Ali Fouani
Mohammad Ali Fouani

Reputation: 135

Just right click drawable>New>Image Asset> Icon Type: Action Bar & Tab Icons... color your want. and add this to your style

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
     <!--... Your Style...-->
     <item name="android:homeAsUpIndicator">@drawable/ic_action_back</item>
 </style>

Just right click drawable>New>Image Asset> Icon Type: Action Bar & Tab Icons...

Upvotes: 0

Mahdi Giveie
Mahdi Giveie

Reputation: 640

finally fixed this by using this line of code :

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

Upvotes: 2

Related Questions