Pinch Zoom and onClickListener for same layout not working in Android -


i've tried implement pinchzoom custom layout in android based on below link.

https://gist.github.com/anorth/9845602

at same time implemented onclicklistener same layout. but, not working when click on particular position in layout, pinch zoom not working after onclick functionality. other wise working fine.

how resolve this?

can suggestion appreciated.

try may you

no need set onclick() method ontouch() handle both case.

package com.example.demo;

import android.app.activity; import android.os.bundle; import android.view.gesturedetector; import android.view.gesturedetector.simpleongesturelistener; import android.view.menu; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; import android.widget.imagebutton;  public class mainactivity extends activity {     private gesturedetector gesturedetector;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         gesturedetector = new gesturedetector(this, new singletapconfirm());         imagebutton imagebutton = (imagebutton) findviewbyid(r.id.img);          imagebutton.setontouchlistener(new ontouchlistener() {              @override             public boolean ontouch(view arg0, motionevent arg1) {                  if (gesturedetector.ontouchevent(arg1)) {                     // single tap                     return true;                 } else {                     // code move , drag                 }                  return false;             }         });      }      private class singletapconfirm extends simpleongesturelistener {          @override         public boolean onsingletapconfirmed(motionevent event) {             return true;         }     }  } 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -