简体   繁体   中英

Toolbar home up button pointing left in RTL

Home up button in RTL is pointing left on Android 5.1(API 22) and lower: 在此输入图像描述

But on Android 6.0(API 23) everything is ok and it's pointing right.

在此输入图像描述

How to solve that?

In your style.xml put:

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

And create a drawable-ldrtl-xhdpi-v17 folder in res and put proper drawable (RTL drawable).

Solution 1 :

You can generate duplicates and keep versions in proper directories (eg drawable-ar).

Solution 2 (My Fav)

Fortunately, there is an easy way around. You just need to use styles.

values/styles.xml
<style name="MirroredImage" />

values-ar/styles.xml
<style name="MirroredImage">
    <item name="android:scaleX">-1</item>
</style>

my_layout.xml
<ImageView
    style="@style/MirroredImage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_to_be_mirrored"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM