Android镜子矢量可绘制
我使用材质图标(ic_play_arrow_black_24dp),并将其导入到vector studio中.
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?
我在两个Floating Action Button中使用了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
比例尺的人来说,效果很好.使用
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
或仅rotation="180"
表示垂直
android:rotation="180" // for vertical
修改:其他
如果要在更改语言RTL/LTR(从右到左"/从左到右")时翻转/镜像图标/可绘制,在android vector drawable中有一种不错的方法,只需检查ckeckbox Enable自动镜像RTL布局.
Additional
If you want to flip/mirror icons/drawable when changing language RTL/LTR ("Right To Left"/"Left To Right"), there is a nice way of doing so in android vector drawable just check the ckeckbox Enable auto mirroring for RTL layout.
=>右键单击可绘制文件夹=>新建=>矢量资产=>选择可绘制=>选中复选框
=> Right Click on drawable folder => New => Vector Asset => Select drawable => check the Checkbox
.