Usage analysis of gesture gesture recognition based on Android

This paper analyzes the usage of gesture gesture recognition implemented by Android. Share with you for your reference. The details are as follows:

I'm glad to see the gesture recognition function on the SDK of Android 1.6. I've been thinking about how to control the game characters with gestures (the exact point should be the gesture) in the NDS game in Android? Now we finally see some dawn, but there are still many details to deal with if we want to control the game characters as freely as the gesture.

A program called gestures builder is pre installed in the Android 1.6 simulator. This program allows you to create your own gestures (the source code of gestures builder is available in the SDK and ask samples. If you are interested, you can have a look). The created gestures will be saved in / sdcard / gestures. Copy this file to your project / RES / raw, and you can use these gestures in your project. The gestures copied to / RES / raw are read-only, that is, you can't modify or add gestures. If you want to add and modify, you can directly load the gestures file in the SD card.

In the example, I created such a gesture:

Step 2: create a gestureoverlayview in the layout. This transparent view is for you to draw gestures on it. It can be superimposed on other views:

Step 3: load gesture:

Step 4: add the response function ongestureperformedlistener:

The above four steps can realize a simple gesture recognition prototype:

The running results of the program are as follows: write an a word, the program recognizes it, and then toast an A:

The complete code is as follows:

For more Android related content, readers who are interested can view the special topics of this website: activity operation skills summary of Android programming, Android view view skills summary, Android SQLite database skills summary, Android JSON format data skills summary, Android database operation skills summary, Android file operation skills summary Summary of SD card operation methods for Android programming development, introduction and advanced tutorial for Android development, summary of Android resource operation skills and summary of Android control usage

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>