开发者

How to handle touch up event in GridView's child views

开发者 https://www.devze.com 2023-03-25 03:37 出处:网络
Application have a GridView with a images. When user press image - looped sound start playing. When us开发者_运维百科er releases image - sound must stop playing.

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

精彩评论

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

关注公众号