动态壁纸onTouchEvent
:) 我试图将触摸与幻灯片分开,但我无法做到正确: - 当用户滑动屏幕时我只想得到幻灯片
public void onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_MOVE ) {
Log.e(Logcat, "1 slide");
}
else
if (event.getAction() == MotionEvent.ACTION_DOWN) {
Log.e(Logcat, "1 touch");
}
super.onTouchEvent(event);
}
谢谢!
编辑
public void onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_MOVE ) {
slide = true;
Log.e(Logcat, "1 slide");
}
else
if (event.getAction() == MotionEvent.ACTION_DOWN) {
slide = false;
}
else if (event.getAction() == MotionEvent.ACTION_UP)
{
if(!slide)
{
touch =1;
Log.e(Logcat, "1 touch");
}
}
super.onTouchEvent(event);
}
这也不起作用,我得到的只是一些幻灯片(即使在触摸时)
:)
I'm trying to separate the touch from the slide but I can't get it right:
- when the user slides the screen I want to get only slides
public void onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_MOVE ) {
Log.e(Logcat, "1 slide");
}
else
if (event.getAction() == MotionEvent.ACTION_DOWN) {
Log.e(Logcat, "1 touch");
}
super.onTouchEvent(event);
}
Thank you!
edit
public void onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_MOVE ) {
slide = true;
Log.e(Logcat, "1 slide");
}
else
if (event.getAction() == MotionEvent.ACTION_DOWN) {
slide = false;
}
else if (event.getAction() == MotionEvent.ACTION_UP)
{
if(!slide)
{
touch =1;
Log.e(Logcat, "1 touch");
}
}
super.onTouchEvent(event);
}
This doesn't work neither, all i get is a number of slides (even on touch)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一些伪代码:
Some pseudo code: