android - Delegate touch event from one view to another -


I'm trying to drop with my own drag and touch view events, I have long click and drag I want to trigger, on the longclick I create visual shadows as a bitmap and this bitmap is set on the image view. I want to draw this image view. My problem is, the image visit is not responding to touch the event immediately after that long click event. I have to stop touching the screen and tap the image again, and then my image is increasing.

Some relevant codes:

  mcategoryNews.setOnLongClickListener (New View.OnLongClickListener () {@Override Public Boolean onLongClick (see v) {v.setVisibility (View.INVISIBLE) ; ImageView Shadow = (getView) getView () findViewById (R.id.imgViewShadow); shadow.setLayoutParams (New FrameLayout.LayoutParams (v.getWidth), v.getHeight ()); shadow.setImageBitmap (Utils.loadBitmapFromView (V)); shadow.bringToFront (); (shadow.getLayoutParams) shadow.getLayoutParams ()) leftMargin = rowCategories1.getLeft (); (); True back;}}); Private View.OnTouchListener mDragShadowTouchListener = New View.OnTouchListener () {@Override Public Boolean onTouch (see V, MotionEvent event) {Log.d ("TAAG"); Switch (event.getAction ()) {case MotionEvent.ACTION_MOVE: Log D. (Tag, "Action Hill"); int x = (int) event.getRawX (); // - rowCategories1.getLeft () - v.getWidth () / 2; int y = (int) event.getRawY (); // - rowCategories1.getTop () - v.getHeight (); FrameLayout Layout Parameters = New Frame Layout. Layout prams (mRowWidth / 2, mRowHeight); Params.setMargins (x, y, 0, 0); v.setLayoutParams (parameter); break; Case MotionEvent.ACTION_DOWN: Break; } Back true; }};   

No log output is present, as long as I keep the finger on the screen after a long tap.

This is a late reply, but I had a similar problem and found this solution:

Pass the motion event in the scene that should be taken through the Dispatch Touch Event Method View MyView = findViewById (R.id.myView); @ Override Public Boolean On Touch Avenger (Motion Avent Event) {myView.dispatchTouchEvent (event); }

After MotionEvent passes it, takes MyView and responds to the new Touch Event.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -