RTL support on ImageButton with autoMirror for src drawable
Make an XML drawable and set android:autoMirrored="true"
. This value is ignored before API 19.
res/drawable/icon_auto_mirrored.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/icon"
android:autoMirrored="true"/>
Now use android:src="@drawable/icon_auto_mirrored
in your layout.
Add
rotationY
to theImageView
:< ImageView ... android:rotationY="@integer/rtl_mirror_flip"
Declare
rtl_mirror_flip
as 0 (for ltr), or 180 (for rtl ) :< integer name="rtl_mirror_flip">0< /integer> or < integer name="rtl_mirror_flip">180< /integer>