Android Mirror Vector Drawable
Answer :
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
OR Try
android:rotationX="180" // for horizontal android:rotationY="180" // for vertical
OR Simply rotation="180"
for vertical
android:rotation="180" // for vertical
Edit: 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
.
I am using AndroidStudio 3.0.1
in Windows 10
.
well, there is no need to create another vector image, you can do it with one single vector image just make sure you do the following step while importing the vector image
So, do usual step to create vector_drawable
,
in case some one don't know,
than here it is..
1.) Right Click on your package
of your app
2.) Than navigate to New => Vector Asset
3.) Than choose your desired icon, in @reebov case it will be ic_arrow_back_black_24dp
4.) You will find Checkbox
with the Option Enable auto mirroring for RTL layout
.
EDIT
You can also Set
android:autoMirrored="true"
in your XML vector file
see below image for more info
and your are done. :)
Set android:autoMirrored="true"
in your XML vector file,
Comments
Post a Comment