Issue
I use a material icon (ic_play_arrow_black_24dp), imported it with the vector studio.
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?
I use the drawable in two Floating Action Button, one for next the other for previous.
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" />
Solution
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
.
Answered By - Inzimam Tariq IT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.