使用android:background="?android:attr/selectableItemBackground"
和android:src="@drawable/ic_action_send"
创建ImageButton时,添加android:autoMirror="true"
没有任何可辨别的效果。有没有办法轻松支持ImageButtons
上的从右到左(RTL)图像镜像?
答案 0 :(得分:13)
制作XML drawable并设置android:autoMirrored="true"
。在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"/>
现在在布局中使用android:src="@drawable/icon_auto_mirrored
。
答案 1 :(得分:1)
将rotationY
添加到ImageView
中:
将rtl_mirror_flip
声明为0(对于ltr)或180(对于rtl):
<整数名称=“ rtl_mirror_flip”> 0 整数>
要么