开发者

check to see if a MotionEvent.ACTION_MOVE was performed

Im making a button in opengl ES that has an overlay with it, like google maps; I want my button to show the overlay when hit and turn it off when the button is hit again. The problem is if the user hits the button and drags around the image then the overlay still turns off. Is there a way to determine if an ACTION_MO开发者_开发百科VE was performed during the course of the event? that way i can set it to only turn off/on if ACTION_MOVE wasn't detected. Thanks.


If I understand, you set your button up like this:

 public void onTouch(View args, MotionEvent ev) {
      if (ev.getAction() == MotionEvent.ACTION_DOWN) doButtonStuff();
      if (ev.getAction() == MotionEvent.ACTION_UP) doOtherButtonStuff();
 }

Just use a touch listener, not a click listener.

~Aedon

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜