Android 中的手势是什么?

发布于 2024-08-15 18:02:00 字数 45 浏览 7 评论 0原文

谁能给我解释一下手势?它们有什么用? 你能告诉我一些可以实施的实用想法吗?

Can anyone explain me about gestures? What are their use?
Can u tell me any practical ideas where we can implement them?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤星 2024-08-22 18:02:00

d.android.com 上有一篇文章专门讨论了这个主题:

http://developer. android.com/training/gestures/index.html

手势将识别用户在屏幕上绘制的任意图案,然后允许您的应用程序执行操作。只要您认为这种行为比按钮更直观或可以节省屏幕空间,就可以使用它们。

至于实用的想法,这实际上取决于您的应用程序的性质。

There's an article on d.android.com on precisely this topic:

http://developer.android.com/training/gestures/index.html

Gestures will recognize an arbitrary pattern drawn by a user on the screen, and then allow your application to perform an action as a result. You use them whenever you think this behavior would be more intuitive than a button or to save screen space.

As for practical ideas, it really depends on the nature of your application.

倾城°AllureLove 2024-08-22 18:02:00

手势通常是 Android 触摸屏上的手指移动,使用 android.gesture 包进行处理。最常见的手势是简单的“点击”,就像电脑上的“鼠标点击”。这种特殊的手势也可以通过 View.OnClickListener 接口检测到。下一个最常见的手势是“拖动”(如在 PC 上用鼠标拖动),您可以在首次打开 Android 设备并拖动锁定滑块以解锁 Android 设备时执行此操作。

但这些是最简单的示例,因为手势包将报告完整的手指移动序列,并允许您的应用程序进行检测,例如,手势是否遵循弯曲的弧线、移动是顺时针还是逆时针以及移动是否缓慢“拖动”或快速“轻弹”。您的应用程序必须能够转换 X/Y 位置和时间戳才能确定移动情况。您可以使用此类动作来移动、拖动和旋转虚拟对象,以进行选择或游戏。

在更复杂的水平上,SDK 包括一个示例应用程序 GestureBuilder(“Gestures Builder”),您可以在模拟器或 Android 上安装并运行该应用程序,从而创建手势“库”。当您的应用获取手势时,它可以将其传递给 GestureLibrary 类,该类将确定该手势是否与您的库中的手势之一匹配。例如,您可能有“顺时针轻拂”的手势。

目前还没有字符识别功能,但这显然是 Android 手势未来的一次演变。

更多详细信息请参见 Android 开发者网站的文章“手势” 。

Gestures are typically finger movements on the Android’s touch-sensitive screen that are processed using the android.gesture package. The most common gesture is a simple “tap”, which is like a “mouse click” on a PC. This particular gesture is also detectable via the View.OnClickListener interface. The next most common gesture is a “drag” (like dragging with a mouse on a PC) which you do when you first turn on your Android and drag the lock slider to unlock your Android.

But these are the simplest examples, as the gestures package will report full finger movement sequences and allow your application to detect, for example, if a gesture follows a curved arc, if the movement is clockwise or counterclockwise and if the movement was a slow “drag” or a quick “flick”. Your application will have to be able to convert the X/Y location and timestamps to figure out what the movements are. You might use such motions for moving, dragging and spinning virtual objects, either for selection, or for a game.

At the next level of sophistication, the SDK includes a sample app, GestureBuilder (“Gestures Builder”), that you can install and run on your emulator or Android that will create a “library” of gestures. When your app gets a gesture, it can pass it to the GestureLibrary class, which will determine if the gesture matches one of the gestures in your library. You might have a “flick clockwise” gesture, for example.

There is no character recognition, yet, but that’s an obvious evolution for the future of Android gestures.

More detailed information is on Android developer website, in the article, “Gestures”.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文