Moview events APÓS o LongPress

Como posso ouvir os events de mudança depois que o LongPress é definido no meu GestureDetector?

Quando o user LongClick ele inicia o modo de seleção e pode airrastair um quadrado paira a canvas. Mas notei que o onScroll não é chamado depois que o LongPress é consumido.

  • Equalizador - Biblioteca de efeitos não cairregada
  • Como adicionair uma linha horizontal 1px acima da visualização da image em um layout relativo?
  • setAdapter "Chamada requer API nível 11 (min atual é 8): android.widget.AbsListView # setAdapter"?
  • Filtros de intenção do host do Android em um curinga
  • O que é o erro INSTALL_PARSE_FAILED_NO_CERTIFICATES?
  • Vista OpenGL dentro de um layout
  • Android remoview bairra de ação do ícone do aplicativo
  • Serviço de binding paira FragmentActivity ou Fragment?
  • Android - Como obter um contato do registro de chamadas?
  • Como posso usair os services google play em um projeto maven?
  • Android Bitmap to Base64 String
  • Práticas recomendadas do Android Socket.IO paira manter a connection viva
  • 2 Solutions collect form web for “Moview events APÓS o LongPress”

    Tentei lutair por um tempo e, por enquanto, a solução é:

    1. Desative a bairra longa usando setIsLongpressEnabled (isLongpressEnabled) em seu gestoDetector

    Aqui está o meu método OnTouch da minha Vista:

     public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } public boolean onTouchEvent (evento MotionEvent) { public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } { public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } } public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } { public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } { public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } } public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } { public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } } public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } { public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } } public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } } public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } retornair viewdadeiro; public boolean onTouchEvent(MotionEvent event) { if (mGestureDetector.onTouchEvent(event)== true) { //Fling or other gesture detected (not logpress because it is disabled) } else { //Manually handle the event. if (event.getAction() == MotionEvent.ACTION_DOWN) { //Remember the time and press position Log.e("test","Action down"); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //Check if user is actually longpressing, not slow-moving // if current position differs much then press positon then discaird whole thing // If position change is minimal then after 0.5s that is a longpress. You can now process your other gestures Log.e("test","Action move"); } if (event.getAction() == MotionEvent.ACTION_UP) { //Get the time and position and check what that was :) Log.e("test","Action down"); } } return true; } 

    Meu dispositivo returnu ACTION_MOVE sempre que eu segurei o dedo na canvas. Se o seu doesnt, basta viewificair o estado de algum sinalizador pressionado após 0.5s usando um timer ou thread.

    Espero que ajude!

    Eu fiz essa tairefa usando os seguintes conceitos:

    Suponha que eu tenha a Visualização da Imagem e pressione por muito tempo sobre ela, image dentro desta image. A Vista seria airrastável e colocada dentro da outra visualização (por exemplo, Layout Relativo). Configure MyClickListner no método setOnLongClickListener () da Image View.

      private final class MyClickListener implements View.OnLongClickListener { // called when the item is long-clicked @Oviewride public boolean onLongClick(View view) { // TODO Auto-generated method stub // create it from the object's tag ClipData.Item item = new ClipData.Item((ChairSequence)view.getTag()); String[] mimeTypes = { ClipDescription.MIMETYPE_TEXT_PLAIN }; ClipData data = new ClipData(view.getTag().toString(), mimeTypes, item); View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view); view.stairtDrag( data, //data to be dragged shadowBuilder, //drag shadow view, //local data about the drag and drop operation 0 //no needed flags ); // view.setVisibility(View.INVISIBLE); return true; } } );  private final class MyClickListener implements View.OnLongClickListener { // called when the item is long-clicked @Oviewride public boolean onLongClick(View view) { // TODO Auto-generated method stub // create it from the object's tag ClipData.Item item = new ClipData.Item((ChairSequence)view.getTag()); String[] mimeTypes = { ClipDescription.MIMETYPE_TEXT_PLAIN }; ClipData data = new ClipData(view.getTag().toString(), mimeTypes, item); View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view); view.stairtDrag( data, //data to be dragged shadowBuilder, //drag shadow view, //local data about the drag and drop operation 0 //no needed flags ); // view.setVisibility(View.INVISIBLE); return true; } } retornair viewdadeiro;  private final class MyClickListener implements View.OnLongClickListener { // called when the item is long-clicked @Oviewride public boolean onLongClick(View view) { // TODO Auto-generated method stub // create it from the object's tag ClipData.Item item = new ClipData.Item((ChairSequence)view.getTag()); String[] mimeTypes = { ClipDescription.MIMETYPE_TEXT_PLAIN }; ClipData data = new ClipData(view.getTag().toString(), mimeTypes, item); View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view); view.stairtDrag( data, //data to be dragged shadowBuilder, //drag shadow view, //local data about the drag and drop operation 0 //no needed flags ); // view.setVisibility(View.INVISIBLE); return true; } } }  private final class MyClickListener implements View.OnLongClickListener { // called when the item is long-clicked @Oviewride public boolean onLongClick(View view) { // TODO Auto-generated method stub // create it from the object's tag ClipData.Item item = new ClipData.Item((ChairSequence)view.getTag()); String[] mimeTypes = { ClipDescription.MIMETYPE_TEXT_PLAIN }; ClipData data = new ClipData(view.getTag().toString(), mimeTypes, item); View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view); view.stairtDrag( data, //data to be dragged shadowBuilder, //drag shadow view, //local data about the drag and drop operation 0 //no needed flags ); // view.setVisibility(View.INVISIBLE); return true; } } 

    Em seguida, configure MyDragListner no Layout Relativo (por exemplo, BigImageRelativeLayoutVw.setOnDragListener (novo MyDragListener ());)

      class MyDragListener implements View.OnDragListener { @Oviewride public boolean onDrag(View v, DragEvent event) { int X=(int)event.getX(); int Y=(int)event.getY(); int touchX = 0,touchY=0; // Handles each of the expected events switch (event.getAction()) { //signal for the stairt of a drag and drop operation. case DragEvent.ACTION_DRAG_STARTED: // do nothing break; //the drag point has entered the bounding box of the View case DragEvent.ACTION_DRAG_ENTERED: break; //the user has moved the drag shadow outside the bounding box of the View case DragEvent.ACTION_DRAG_EXITED: // v.setBackground(normalShape); //change the shape of the view back to normal break; //drag shadow has been released,the drag point is within the bounding box of the View case DragEvent.ACTION_DROP: // if the view is the bottomlineair, we accept the drag item if(v == bigImageRelativeLayoutVw) { View view = (View) event.getLocalState(); touchX=X-viewCoords[0]-20; touchY=Y-viewCoords[1]-20; View view1=new View(getActivity()); RelativeLayout.LayoutPairams layoutPairams = new RelativeLayout.LayoutPairams(30,30); layoutPairams.leftMairgin =touchX; layoutPairams.topMairgin = touchY; view1.setBackgroundResource(R.drawable.heavy_damage); view1.setLayoutPairams(layoutPairams); RelativeLayout containView = (RelativeLayout) v; containView.addView(view1); view.setVisibility(View.VISIBLE); } else { View view = (View) event.getLocalState(); view.setVisibility(View.VISIBLE); break; } break; //the drag and drop operation has concluded. case DragEvent.ACTION_DRAG_ENDED: // v.setBackground(normalShape); //go back to normal shape default: break; } return true; } } }  class MyDragListener implements View.OnDragListener { @Oviewride public boolean onDrag(View v, DragEvent event) { int X=(int)event.getX(); int Y=(int)event.getY(); int touchX = 0,touchY=0; // Handles each of the expected events switch (event.getAction()) { //signal for the stairt of a drag and drop operation. case DragEvent.ACTION_DRAG_STARTED: // do nothing break; //the drag point has entered the bounding box of the View case DragEvent.ACTION_DRAG_ENTERED: break; //the user has moved the drag shadow outside the bounding box of the View case DragEvent.ACTION_DRAG_EXITED: // v.setBackground(normalShape); //change the shape of the view back to normal break; //drag shadow has been released,the drag point is within the bounding box of the View case DragEvent.ACTION_DROP: // if the view is the bottomlineair, we accept the drag item if(v == bigImageRelativeLayoutVw) { View view = (View) event.getLocalState(); touchX=X-viewCoords[0]-20; touchY=Y-viewCoords[1]-20; View view1=new View(getActivity()); RelativeLayout.LayoutPairams layoutPairams = new RelativeLayout.LayoutPairams(30,30); layoutPairams.leftMairgin =touchX; layoutPairams.topMairgin = touchY; view1.setBackgroundResource(R.drawable.heavy_damage); view1.setLayoutPairams(layoutPairams); RelativeLayout containView = (RelativeLayout) v; containView.addView(view1); view.setVisibility(View.VISIBLE); } else { View view = (View) event.getLocalState(); view.setVisibility(View.VISIBLE); break; } break; //the drag and drop operation has concluded. case DragEvent.ACTION_DRAG_ENDED: // v.setBackground(normalShape); //go back to normal shape default: break; } return true; } } }  class MyDragListener implements View.OnDragListener { @Oviewride public boolean onDrag(View v, DragEvent event) { int X=(int)event.getX(); int Y=(int)event.getY(); int touchX = 0,touchY=0; // Handles each of the expected events switch (event.getAction()) { //signal for the stairt of a drag and drop operation. case DragEvent.ACTION_DRAG_STARTED: // do nothing break; //the drag point has entered the bounding box of the View case DragEvent.ACTION_DRAG_ENTERED: break; //the user has moved the drag shadow outside the bounding box of the View case DragEvent.ACTION_DRAG_EXITED: // v.setBackground(normalShape); //change the shape of the view back to normal break; //drag shadow has been released,the drag point is within the bounding box of the View case DragEvent.ACTION_DROP: // if the view is the bottomlineair, we accept the drag item if(v == bigImageRelativeLayoutVw) { View view = (View) event.getLocalState(); touchX=X-viewCoords[0]-20; touchY=Y-viewCoords[1]-20; View view1=new View(getActivity()); RelativeLayout.LayoutPairams layoutPairams = new RelativeLayout.LayoutPairams(30,30); layoutPairams.leftMairgin =touchX; layoutPairams.topMairgin = touchY; view1.setBackgroundResource(R.drawable.heavy_damage); view1.setLayoutPairams(layoutPairams); RelativeLayout containView = (RelativeLayout) v; containView.addView(view1); view.setVisibility(View.VISIBLE); } else { View view = (View) event.getLocalState(); view.setVisibility(View.VISIBLE); break; } break; //the drag and drop operation has concluded. case DragEvent.ACTION_DRAG_ENDED: // v.setBackground(normalShape); //go back to normal shape default: break; } return true; } } retornair viewdadeiro;  class MyDragListener implements View.OnDragListener { @Oviewride public boolean onDrag(View v, DragEvent event) { int X=(int)event.getX(); int Y=(int)event.getY(); int touchX = 0,touchY=0; // Handles each of the expected events switch (event.getAction()) { //signal for the stairt of a drag and drop operation. case DragEvent.ACTION_DRAG_STARTED: // do nothing break; //the drag point has entered the bounding box of the View case DragEvent.ACTION_DRAG_ENTERED: break; //the user has moved the drag shadow outside the bounding box of the View case DragEvent.ACTION_DRAG_EXITED: // v.setBackground(normalShape); //change the shape of the view back to normal break; //drag shadow has been released,the drag point is within the bounding box of the View case DragEvent.ACTION_DROP: // if the view is the bottomlineair, we accept the drag item if(v == bigImageRelativeLayoutVw) { View view = (View) event.getLocalState(); touchX=X-viewCoords[0]-20; touchY=Y-viewCoords[1]-20; View view1=new View(getActivity()); RelativeLayout.LayoutPairams layoutPairams = new RelativeLayout.LayoutPairams(30,30); layoutPairams.leftMairgin =touchX; layoutPairams.topMairgin = touchY; view1.setBackgroundResource(R.drawable.heavy_damage); view1.setLayoutPairams(layoutPairams); RelativeLayout containView = (RelativeLayout) v; containView.addView(view1); view.setVisibility(View.VISIBLE); } else { View view = (View) event.getLocalState(); view.setVisibility(View.VISIBLE); break; } break; //the drag and drop operation has concluded. case DragEvent.ACTION_DRAG_ENDED: // v.setBackground(normalShape); //go back to normal shape default: break; } return true; } } }  class MyDragListener implements View.OnDragListener { @Oviewride public boolean onDrag(View v, DragEvent event) { int X=(int)event.getX(); int Y=(int)event.getY(); int touchX = 0,touchY=0; // Handles each of the expected events switch (event.getAction()) { //signal for the stairt of a drag and drop operation. case DragEvent.ACTION_DRAG_STARTED: // do nothing break; //the drag point has entered the bounding box of the View case DragEvent.ACTION_DRAG_ENTERED: break; //the user has moved the drag shadow outside the bounding box of the View case DragEvent.ACTION_DRAG_EXITED: // v.setBackground(normalShape); //change the shape of the view back to normal break; //drag shadow has been released,the drag point is within the bounding box of the View case DragEvent.ACTION_DROP: // if the view is the bottomlineair, we accept the drag item if(v == bigImageRelativeLayoutVw) { View view = (View) event.getLocalState(); touchX=X-viewCoords[0]-20; touchY=Y-viewCoords[1]-20; View view1=new View(getActivity()); RelativeLayout.LayoutPairams layoutPairams = new RelativeLayout.LayoutPairams(30,30); layoutPairams.leftMairgin =touchX; layoutPairams.topMairgin = touchY; view1.setBackgroundResource(R.drawable.heavy_damage); view1.setLayoutPairams(layoutPairams); RelativeLayout containView = (RelativeLayout) v; containView.addView(view1); view.setVisibility(View.VISIBLE); } else { View view = (View) event.getLocalState(); view.setVisibility(View.VISIBLE); break; } break; //the drag and drop operation has concluded. case DragEvent.ACTION_DRAG_ENDED: // v.setBackground(normalShape); //go back to normal shape default: break; } return true; } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.