Skip to content

A custom ImageView that can rotate, translate, and scale the image

Notifications You must be signed in to change notification settings

zuohail/TransformativeImageView

 
 

Repository files navigation

TransformativeImageView

A custom ImageView that can rotate, pan, and scale the image

introduction

Screenshot

screenshot

Add dependency

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

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

Step 2. Add the dependency

dependencies {
	compile 'com.github.cnlkl:TransformativeImageView:1.1.3'
}

How to use

Activity

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TransformativeImageView transformativeImageView1 =
                (TransformativeImageView) findViewById(R.id.multi_touch_view1);
		// Use glid to load image
        GlideApp.with(this)
                .load(R.drawable.cat)
                .into(transformativeImageView1);
    }
}
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="cn.lkllkllkl.transformativeimageviewsample.MainActivity">

    <cn.lkllkllkl.transformativeimageview.TransformativeImageView
        android:background="@color/gray"
        android:id="@+id/transformative_image_view"
        android:layout_gravity="center"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:open_rotate_revert="true"
        app:open_scale_revert="true"
        app:open_translate_revert="true"
        app:revert_duration="300"
        app:max_scale="4"
        app:min_scale="1"
        app:scale_center="finger_center"
        />

</FrameLayout>

About

A custom ImageView that can rotate, translate, and scale the image

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%