);Matrix.setrotatem (Mrotationmatrix,0, MAngle,0,0, -1.0f);//Combine the rotation matrix with the projection and camera view //Note that the Mmvpmatrix factor *must is first* in order //For the matrix multiplication product to be correct.Matrix.multiplymm (Scratch,0, Mmvpmatrix,0, Mrotationmatrix,0);//Draw triangleMtriangle.draw (scratch);}If you have completed the steps described above, start the program and then drag on the screen to rotate the triangle:
Android has two classesAndroid. View. gesturedetectorAndroid. View. gesturedetector. simpleongesturelistener
(In addition, Android. widget. gallery seems to be a better ongesturelistener)
1)Create a class that inherits the simpleongesturelistener and hahagesturedetectorlistenerYou can implement the following Event Events.
Boolean ondoubletap (motionevent E)Explanation: triggered when the second
1. Touch Screen calibration principle
For more information, see http://blog.sina.com.cn/wyw1976.
2. General Method of touch screen Calibration
The following formula is used to implement touch screen correction. XL, yl are the display coordinate, XT, and yt are the touch screen coordinate,
XL = XT * A + yt * B + C;
YL
Events in AndroidTouch events, four states:
Action_down--> said the screen was pressed, an event must start from Action_downAction_move--> represents a move gestureAction_up--> means leaving the screenAction_cancel--> indicates that the cancellation gesture is normally generated by the program and is not generated by the user
A action_down, n action_move,1 action_up, constitutes a multitude of events in Android.The event onclick, onscroll, onfling and so on in
, Ev);
Addlocked (Di, curtime, Ev.flags, ..., me);
}
}
};
Input Event Distribution ThreadAn input event distribution thread was created in Frameworks/base/services/java/com/android/server/windowmanagerservice.java, which is responsible for distributing the event to the appropriate window.
Mqueue.getevent
Dispatchkey/dispatchpointer/dispatchtrackball
keypad, touch screen process An
Go ahead and tidy up some of the problems and techniques you've encountered in the Android development process.
1.4.0 or more versions of Android cannot be networked in the main threadThe Android application runs in a Dalvik virtual machine process, which starts with a main thread (Mainthread) that, in Android 4.0 or
This address, reproduced please specify: http://blog.csdn.net/dearsq/article/details/51251009How Hardware WorksThe working principle of the touchscreen is to report the values of coordinate values, x-axis and y-axis. So the input subsystem is used in Linux to implement it.Specific hardware principles can refer to this article capacitive touch-screen hardware fundamentals.This paper mainly summarizes the driving principles and porting steps on
first look at a few functions: mention of the Android Touch event processing, many people will immediately think of some of the headaches of the function, here to list, stimulate your little nerves: @Override Public Boolean ontouchevent(Motionevent event) {return Super. Ontouchevent (event); }@Override Public Boolean dispatchtouchevent(Motionevent ev) {return Super. dispatchtouchevent (EV); }@Ove
Turn from: The distribution and consumption mechanism of Touch events under Android programmingTouch event-related methods include: Dispatchtouchevent (motionevent ev), onintercepttouchevent (motionevent ev), Ontouchevent (motionevent EV); The controls that respond to these methods include: ViewGroup and its subclasses, Activity. The corresponding relationship between the method and the control is shown in
Analyze how Android reads keys and touch panel drivers. This is mainly in the $ (android_dir)/frameworks/base/libs/UI/eventhub. cpp file. This is at the Hal layer, which will step by step analyze how the android upper layer accepts events. First, let's take a look at Android halclass eventhub at $ (android_dir)/framewo
I recently studied multi-touch and wrote a program that uses multi-touch to control image size and single-touch to control image movement.
In Android, The ontouchevent method is used to listen to touch events. Its parameter is motionevent. The following lists some common mo
: Movement speed on velocityx:x axis px/s Wu * @param: Movement speed on the velocityy:y axis - */ About Public BooleanOnfling (motionevent E1, motionevent E2,floatVelocityx,floatvelocityy) { $LOG.V (TAG, "onfling"); -Toast.maketext (mainactivity. This, "Onfling", Toast.length_short). Show (); - - return false; A } + }); the - @Override $ Public Booleanontouchevent (Motionevent event) { theLOG.V (TAG, "Ontouchevent"); the if(Gesturedetector.ontouchevent (event))
Various events in Android are implemented by different listeners. For example, the key event is monitored by onclicklistener, And the touch event is listened by ontouchlistener.
First set the listener, and then input the event to be listened on
Public class touch913mainactivity extends activity {relativelayout RL; textview TV, TV2; @ override public void oncreate (bundle savedinstancestate) {super. oncre
Reprint Please specify source: http://blog.csdn.net/guolin_blog/article/details/11100327In the previous article I took everyone together to achieve the effect of the image wall of the Android waterfall, although the effect is very cool, but in fact, it can only be considered a semi-finished, because all the pictures in the photo wall can only be seen can not point. Therefore, in this article, we will be able to perfect this function, add click on the
The methods associated with Touch events in Android include:dispatchtouchevent (motionevent ev),onintercepttouchevent (motionevent ev) ,ontouchevent (motionevent ev); controls that can respond to these methods include:viewgroup,View,Activity. The corresponding relationship of the method to the control, as seen in the following table:
Touch Event-rela
Brief introduction:Made a small demo of the voice sending UI.Press the show voice form to display the volume adjustment UI volume, up to the form display cancel send.Principle:1: Get what event to run the operation:Add the Setontouchlistener event to the button, get a touch event, get the coordinates of the current display control in the slide event, and then infer from the current touch position and coordi
Android Multi-point touch knowledge points
1, Scalegesturedetector2, Onscalegesturelistener3. Matrix4, Ontouchlistener
Four points of knowledge need to be aware that the matrix in memory is a one-dimensional array, manipulating the image of the matrxi is a 3x3 matrix, in memory is a size of 9 one-dimensional array.
Realize multi-touch, free change picture
1,
respect for the original:http://blog.csdn.net/yuanzeyao/article/details/38942135About the Android Touch event delivery mechanism I have written two articles before, I think I understand the Touche incident is quite clear, but recently encountered a problem, let me once again on the Android Touche event to learn.My article about the
respect for the original:http://blog.csdn.net/yuanzeyao/article/details/38942135About the Android Touch event delivery mechanism I have written two articles before, conscious of the Touche incident or understand clearly, but recently encountered a problem, let me once again on the Android Touche event to learn.My article about the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.