开发者

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;

    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜