Zoom, Drag & Rotate ImageView (可拉伸,托拉和旋转的imageview)
It is called RotateImageview extends from ImageView,
it has multiple gestures ,you can get the same ImageView features as well .
这是一个多功能ImageView,
能够实现多样的手势控制
-
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
(将jitpack加入到build.gradle,如下所示)
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
-
Step 2. Add the dependency
(加入SDK套件)
dependencies {
implementation 'com.github.lau1944:Zoom-Drag-Rotate-ImageView:currentversion'
}
-
Step 3. Add Image (添加图片)
You can add it on XML file (在xml上直接加入)
<com.easystudio.rotateimageview.RotateZoomImageView
android:id="@+id/rotate"
android:layout_width="150dp"
android:layout_height="150dp"
android:src="@drawable/money"/>
Or add image programmatically (或者用java上加入)
RotateZoomImageView iv;
RelativeLayout playground = findViewById(R.id.playground);
iv = new RotateZoomImageView(getApplicationContext());
iv.setImageDrawable(getDrawable(R.drawable.money));
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(250, 250);
lp.addRule(RelativeLayout.BELOW);
iv.setLayoutParams(lp);
playground.addView(iv);
- Final Step. Add OnTouch Method (再加入如下监听事件)
iv.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return iv.onTouch(v,event);
}
});
+ Donate with wechat