Android's touch event processing mechanism is complicated, especially after considering multi-point touch and event interception.
Android touch event processing has three layers: Activity layer, viewgroup layer, and view layer.
First, let's talk about several basic rules of tou
The previous article focused on the TouchEvent distribution process for Android, with two important functions: Onintercepttouchevent and Ontouchevent, which can be re-installed to complete specific logic. The onintercepttouchevent is defined as ViewGroup, and the default return value is False, which means that touchevent is not intercepted. The definition of ontouchevent is in view, and super.ontouchevent is used when viewgroup to invoke Ontouchevent.
First look at a picture
Copyright statement: This is the csdn on the other people's map, I feel useful, took over,Then simply explain:In general, the touch event is passed from the outermost viewgroup to the first level.The callback method for each view associated with this is three, dispatchtouchevent,onintercepttouchevent, and the familiar outoucheventThe event is passed to a view (ViewGroup), which is first recalled to the Dispatchtouchevent () me
Currently, capacitive touch screens are generally used for android phones. Therefore, multi-touch is basically supported. In android Systems, Applications can also use multi-touch events to fulfill various gestures and scenarios, the following describes how to use multi-
method is to get the number of current fingers
Case one: Font scaling with two-finger touch
Paste the code directly here, first put out the layout code
"Http://schemas.android.com/apk/res/android"xmlns:tools="Http://schemas.android.com/tools"Android:layout_width="Match_parent"android:layout_height="Match_parent"> com. Example. Scaletextview. ZoomtextviewAndroid:id="@+id/textview"Android:
two sentences (including the above __set_bit (Ev_abs, input_dev->evbit) are optional, because the corresponding settings are made in the Input_set_abs_params function.And this sentence __set_bit (Input_prop_direct, Input_dev->propbit), but also must have, otherwise there will be a small white ring in Android, it feels like the lack of IDC files. Finally, through the getevent-p command to see the touch scre
raw data is generatedInput_report_absReport onAndroidLayer. InAndroidThe layer will passGetxAndGetyCapture this data, and then pass the captured data throughReportdataDistribute to the window.
From the data movement process, we probably know where to start with correction. The correction process is data interception.-Modification Process. This is becauseAndroidTherefore, we needAndroidLayer data is intercepted.AndroidThe data of the layer touch scre
Embedded Linux/android Drive Development Secret (1) Touch screen driver developmentSpecial Introduction: Since 1971, when American Samhurst invented the world's first touch sensor, touch-screen technology has been innovating, giving programmers and UI engineers unlimited space to imagine, which greatly improves the end
Differences between Android touch events and click events
6I want to add this article to my favorites for 12 months ago ().
4811Total times of reading
5Comments
For a view control on the screen, how does Android differentiate whether an ontouchevent, onclick, or onlongclick event should be triggered?
In Android, a us
different from Onsingletapup, he is in Gesturedetector convinced that the user after the first touch of the screen, not immediately following the second touch of the screen. That is, not a "double click" trigger.Tip://distanceX。是前后两次call的X距离,不是e2与e1的水平距离; 是前后两次call的Y距离,不是e2与e1的垂直距离Usage:1: Inheritance Gesturedetector.ongesturelistener2: Instantiate the detector gesturedetector mdetector = new Gesturedetect
required because Android WebView after 4.4 is already the chromium kernel.②, using the Chromium kernel PhoneGap project, when using some PhoneGap plug-ins, will be error, such as Filetransfer plug-ins.Filetransfer plugin needs to be modified to fit, modify the method click here--------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------
Objective:(1) In Custom view, often encounter event interception processing, such as in the side-slip menu, we would like to have a ListView control in the Slide menu, but we want to both swipe left and right to slide, this time we need to intercept touch events. This time we need to understand the Android touch event delivery mechanism,(2) before a lot of time i
The previous article has already brought everybody to realize the free enlargement to reduce the picture, introduced the next matrix simply; Please refer to: Android to achieve gesture sliding multi-touch zoom translation Image effect, this article continues to improve our imageview.
First add the amplification after the move.
1, free to move
We are in the ontouchevent, plus the moving code, of course, m
When I first started learning Android, I felt that Google's documents were not good, and when we studied gestures, I felt that Google's documents were too poor. A lot of constants, properties, and methods don't even have a description.There is no description, but there are so many gestures in ongesturelistener, it does not have a description, who can understand onlongpress and onshowpress before they try.Is there a difference between onscroll and onfl
Recently, a multi-touch scaling function is required. Then I checked the information online and summarized it as follows:
First, the android SDK version is very important. For example, if you specify Android: minsdkversion = "4" in androidmanifest. xml and select Android 2.2 when creating the project, your application
. These three events identify the most basic user touch screen operations and have a clear meaning. Although they are used every day, please note that the importance of the ACTION_DOWN event as the starting event is greater than ACTION_MOVE and ACTION_UP. If ACTION_MOVE or ACTION_UP occurs, therefore, ACTION_DOWN must have occurred. Some interaction mechanisms implemented based on the understanding of different importance can be seen from the
The processing of Android touch events mainly involves several methods: Onintercepttouchevent (), Dipatchtouchevent (), Ontouchevent (), OnTouch (). Onintercepttouchevent () is used to intercept events and change the direction of event delivery. Explain the event delivery. For example, an activity that shows a user may be a multi-layered nesting of viewgroup and view, by default the
Android-developed friends often deal with a variety of touch events, but in the process of touching events, there are three main methods: Dispatchtouchevent (), Onintercepttouchevent (), and ontouchevent (). Believe that this troubled a lot of friends, the following through the text to you about the transfer process between them.Tools/Materials
Android
Because many of the Code has been designed for the first five advanced steps, we will not repeat them here. List the core code.Part 1: xml fileSelect an image with one button and save the image with one buttonThe Code is as follows:1. 2. 3. android: layout_width = "fill_parent"4. android: layout_height = "fill_parent"5. android: orientation = "vertical">6.7. 8.
Respect for the original: http://blog.csdn.net/yuanzeyao/article/details/38025165Download resources: http://download.csdn.net/detail/yuanzeyao2008/7660997In the previous article, I focused on the transfer of touch events in the Android source code, and now I want to use a demo and an example to learn about the Touch event processing in Andorid.In
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.