[英]Is there a way to get the Android button pressed state?
The Android Button has only ACTION_UP
, ACTION_DOWN
, and ACTION_MOVE
states, so I can't hold down the Button
for a long time... As a simple example, I want to make a top, bottom, left and right Button and move the square box displayed on the screen ( drawRect
drawn on Canvas
). Android Button只有
ACTION_UP
, ACTION_DOWN
和ACTION_MOVE
状态,所以我不能长时间按住Button
...举个简单的例子,我想做一个顶部,底部,左侧和右侧的Button并移动屏幕上显示的方框(在Canvas
上绘制的drawRect
)。 I want to implement a state in which the box continues to rise when the upper button is pressed.我想实现一个 state,当按下上按钮时,盒子会继续上升。
What listener should be attached to the Button
??应该将什么侦听器附加到
Button
?
you can change the box position when you press down, and when the ACTION_UP event happened, stop box position change您可以在按下时更改框 position,当 ACTION_UP 事件发生时,停止框 position 更改
I would check out threads for this:我会为此检查线程:
http://tutorials.jenkov.com/java-concurrency/creating-and-starting-threads.html http://tutorials.jenkov.com/java-concurrency/creating-and-starting-threads.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.