Android 镜像矢量可绘制 [英] Android mirror vector drawable
问题描述
我使用材质图标 (ic_play_arrow_black_24dp),使用矢量工作室导入它.
I use a material icon (ic_play_arrow_black_24dp), imported it with the vector studio.
现在我希望箭头也指向另一个方向,而无需创建第二个向量.这在 xml 中可能吗?如何实现?
Now I want the arrow to point in the other direction as well, without creating a second vector. Is this possible in xml and how?
我在两个浮动操作按钮中使用 drawable,一个用于下一个,另一个用于上一个.
I use the drawable in two Floating Action Button, one for next the other for previous.
编辑这是 fab 按钮的 XML.我已经尝试过旋转和缩放,但没有用
Edit here is the fab button's XML. I tried already rotation and scale, but it didn´t work
<android.support.design.widget.FloatingActionButton
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|bottom"
android:layout_marginBottom="0dp"
android:layout_marginEnd="80dp"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:src="@drawable/next_prev_24dp"
app:layout_anchor="@id/next"
app:layout_anchorGravity="left" />
推荐答案
对于那些使用 ImageView
或 TextView
或 EditText
Scale 效果很好的人.使用
For those who Use ImageView
or TextView
or EditText
Scale works perfectly. Use
android:scaleX="-1" //To flip horizontally or
android:scaleY="-1" //To flip vertically
或尝试
android:rotationX="180" // for horizontal
android:rotationY="180" // for vertical
OR 简单地rotation="180"
垂直
android:rotation="180" // for vertical
附加
如果您想在更改语言 RTL/LTR(从右到左"/从左到右")时翻转/镜像图标/drawable,在 android vector drawable 中有一个很好的方法,只需选中 ckeckbox EnableRTL 布局的自动镜像.
=> 右键单击可绘制文件夹 => 新建 => 矢量资源 => 选择可绘制 => 选中复选框
=> Right Click on drawable folder => New => Vector Asset => Select drawable => check the Checkbox
.
这篇关于Android 镜像矢量可绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!