简体   繁体   English

按下按钮时无需从屏幕上松开手指

[英]Press buttons without release finger from screen

I want to press buttons like it shown on this picture http://i.stack.imgur.com/C1NW3.jpg . 我想按此图片所示的按钮http://i.stack.imgur.com/C1NW3.jpg That is I want to press buttons by holding finger on the screen and moving it along buttons. 那就是我想通过按住手指在屏幕上并沿按钮移动按钮来按下按钮。 For example on this pic buttons 1, 2,5,8,9 will be pressed after this procedure. 例如,在此图片上,此过程后将按下按钮1,2,5,8,9。 Sorry for my bad english, but i cant to describe this in a different way. 对不起,我的英语不好,但是我不能用另一种方式来形容。

How I can do this? 我该怎么做?

Well, sorry for not providing the very simple answer like "use the function xyz()" for this, but I think there are some general ways to do it: 好吧,很抱歉没有为此提供“使用函数xyz()”这样的非常简单的答案,但是我认为有一些通用的方法可以做到这一点:

  1. You can create pictures that look like buttons (or bubbles or anything else appropriate), place them in an order that you need and then, getting each coordinate of the pointer (of the finger) on the screen, just check if this pointer gets into some area (maybe rectangle) inside each button. 您可以创建看起来像按钮(或气泡或其他合适的东西)的图片,并按需要的顺序放置它们,然后将(手指的)指针的每个坐标显示在屏幕上,只需检查该指针是否进入每个按钮内的某些区域(可能是矩形)。 This logical area should be smaller than shown picture to let user move finger not so careful. 该逻辑区域应小于显示的图片,以使用户不必太小心移动手指。

  2. Another "solution" would be to put some "jitter" and send "left click" message on each position update along the way. 另一个“解决方案”是在途中的每个位置更新上放置一些“抖动”并发送“左键单击”消息。 In this case buttons should have some protection from multiple clicks. 在这种情况下,按钮应具有一定的保护作用,以防止多次单击。 I remember on stackoverflow.com some advice how to do this: just disable the button on the click event. 我记得在stackoverflow.com上有一些建议如何执行此操作:只需禁用click事件上的按钮。

Sorry if Android has some solution "out of the box", which I have no idea about, but the described problem seems to be general, not platform-specific. 抱歉,如果Android有“现成的”解决方案,我不知道,但是所描述的问题似乎是普遍的,而不是特定于平台的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM