Zoom, Drag & Rotate ImageView For Android

Jimmy leo
2 min readMay 12, 2020

--

I made a small android package for imageView on Android . Basically, if you want zoom, drag & rotate gestures on your imageView, you can try this, it’s really easy to use.

Let’s Start…

First, add jitpack to your build.gradie file

allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

Next, add the dependency

dependencies {
implementation 'com.github.lau1944:Zoom-Drag-Rotate-ImageView:1.0.0'
}

Then, you can use the imageView now , the class is called RotateZoomImageView.

. Add On Xml

<com.easystudio.rotateimageview.RotateZoomImageView
android:id="@+id/rotate"
android:layout_width="150dp"
android:layout_height="150dp"
android:src="@drawable/money"/>

. Programmaticallty (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);

.Don’t forget to declare onTouch Method , or it won’t work .

iv.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return iv.onTouch(v,event);
}
});
demo

That is it !

You can also check out the source code on github

--

--

Jimmy leo
Jimmy leo

No responses yet