When creating an ImageButton with android:background="?android:attr/selectableItemBackground" and android:src="@drawable/ic_action_send", adding android:autoMirror="true" does not have any descernable affect. Is there any way to easily support Right-To-Left (RTL) image mirroring on ImageButtons?
Add rotationY to the ImageView :
< 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>
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With