I use example with zoom and scrool big image, which use GestureDetector code here . When I place button on it, I cannot handle any button events - both onClickListener, OnTouchListener doesn't fired.
public class ScrollableView extends AbsoluteLayout implements OnGestureListener, OnDoubleTapListener {
private GestureDetector mGestureDetector;
private ImageView mImageView;
private Context mContext;
Button mZoomIn;
public ScrollableView(Context context) {
super(context);
mContext = context;
mZoomIn = new Button(context);
mZoomIn.setText("OK");
RelativeLayout.LayoutParams startparam = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
startparam.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mZoomIn.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(mContext, "Click!", Toast.LENGTH_SHORT);
}
});
this.addView(mZoomIn);
mGestureDetector = new GestureDetector(this);
}
What is my mistake?