Issue
Here is a class which performs Drag, Zoom and Rotate of an ImageView.
xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="matrix"
android:src="@drawable/butterfly" />
</FrameLayout>
But it was all done on the Matrix of the ImageView using the imageView.setImageMatrix(matrix);
Not the actual image view.
Hence the below results:
Initial ImageView:
On Dragging right:
On Zooming in:
On Rotating:
Is there a way I can modify the ImageView to change as per it's Matrix?
Solution
You can call View.setRotation()
, View.setPivotX()
, View.setPivotY()
, View.setScaleX()
, View.setScaleY()
, View.setTranslationX()
and View.setTranslationY()
ond any View including an ImageView
.
Reference: http://developer.android.com/reference/android/view/View.html
Answered By - HHK
Answer Checked By - Mildred Charles (JavaFixing Admin)