Share Coding

Tutorials, Problems, Stuffs …

Android A powerful ImageView support touch and multi touch function

MikeOrtiz TouchImageView

Place TouchImageView.java into src/
In your res/layout/main_activity.xml

<com.example.touch.TouchImageView
	    android:id="@+id/img”
	    android:layout_width="match_parent"
	    android:layout_height="match_parent" />

 


In your src/MainActivity.java, onCreate()

TouchImageView touchImageView = (TouchImageView) findViewById(R.id.img);
touchImageView.setOnDoubleTapListener(new GestureDetector.OnDoubleTapListener() {
    @Override
    public boolean onSingleTapConfirmed(MotionEvent e) {
        if(actionBar.isShowing()){
            actionBar.hide();
        }else{
            actionBar.show();
        }
        return false;
    }

    @Override
    public boolean onDoubleTap(MotionEvent e) {
        return false;
    }

    @Override
    public boolean onDoubleTapEvent(MotionEvent e) {
        return false;
    }
});

 

What you can enjoy by this TouchImageView?

Pinch zoom, dragging, fling, double tap zoom functionality and other animation polish.
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: