这里是一个执行ImageView的拖曳、缩放和旋转的类,请点击 这里 进入源代码。
接下来是xml相关内容。
接下来是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>
但所有操作都是在 ImageView 的 Matrix 上完成的,使用 imageView.setImageMatrix(matrix);
而不是实际的图像视图。
因此,以下是结果:
初始 ImageView:
向右拖动:
缩小:
旋转:
我是否可以修改 ImageView 以根据其 Matrix 进行更改?