2016-11-03 43 views

回答

0

您可以使用onTouchListener用于此目的:

view.setOnTouchListener(new View.OnTouchListener() {   
    @Override 
    public boolean onTouch(View v, MotionEvent event) { 
     switch(event.getAction()) { 
      case MotionEvent.ACTION_DOWN: 
       // PRESSED 
       return true; // if you want to handle the touch event 
      case MotionEvent.ACTION_UP: 
       // RELEASED : Play the music here 
       return true; // if you want to handle the touch event 
     } 
     return false; 
    } 
}); 
+0

这将如何赶上长按? –