开发者

two views ontouchlistener same area how to?

开发者 https://www.devze.com 2023-01-31 22:21 出处:网络
I have a two ImageViews. 1.ImageView zoomImageMoveable : should zoom in,out and moveable. 2.ImageView zoomImageFixed : show zoom this is guide line.

I have a two ImageViews.

1.ImageView zoomImageMoveable : should zoom in,out and moveable. 2.ImageView zoomImageFixed : show zoom this is guide line.

I want run different functions from one touch.

{
 Fram开发者_StackOverfloweLayout myFrame = new FrameLayout(this.getContext());
     myFrame.addView(zoomImageMoveable);
     myFrame.addView(zoomImageFixed);
}

Case 1. I tried to attach a listener to each of the view, as they are overlapping only one works.

Case 2. I also tried to wrap the two view with a FrameLayout and added an OnTouchListener to that layout to have it forward the calls to each of the assigned methods. Yet this method also didn't work.

 myFrame.setOnTouchListener(new OnTouchListener() {
      @Override
      public boolean onTouch(View v, MotionEvent event) {
           zoomImageMoveable.onTouchEvent(event);
           zoomImageFixed.onTouchEvent(event);
           return false;
      }
 });

How should I approach this issue?

0

精彩评论

暂无评论...
验证码 换一张
取 消