How to handle touch up event in GridView's child views
Application have a GridView with a images. When user press image - looped sound start playing. When us开发者_运维百科er releases image - sound must stop playing.
I cannot find the way to handle release event.
write touch event in getview method of adapter class. it will work.
public boolean onTouch(View arg0, MotionEvent e) {
switch(e.getAction()){
case(MotionEvent.ACTION_DOWN):
//the user put his finger down on screen
break;
case(MotionEvent.ACTION_MOVE):
//the user is moving with his finger down
break;
case(MotionEvent.ACTION_UP):
//the users finger is off the screen
break;
}
}
精彩评论