Android presses multiple buttons at the same time

Source: Internet
Author: User

Keywords: multitouch, controls, buttons, Android, while pressing "maybe this will help more people retrieve it?" 】


A long time did not write blog, recently in the process of graduation design, encountered such a problem, has not encountered before, took some detours, now write down the record.


In the process of Baidu did not see the relevant answers, and more still take you to the detour. Let's get to the bottom of the blog.




Problem: Implement the "Baidu handle" of this multiple buttons, while clicking, that is, a button point is not put, another button is clicked.


In fact, many people's first reaction is that this stuff is not the original Android can it? And then vowed to write a demo and found that in fact not.


Everyone will listen to the touch event, and then do the processing, you can find that you press the first button, and then press the other button, the other buttons of the touch is not to be executed, but to go to the first button touch inside the process flow.


Immediately after everyone to Baidu, Baidu everyone with you answer is with multi-touch, and a bunch of information very clearly tell you to listen to a few fingers to tap the screen .... At this point your heart's answer is basically stereotypes, and then began to write multi-touch processing process.


In the end you will find that you are dealing with your own problems, and you need to go through your finger x, y to determine what controls are now clicked. Then you will encounter a problem, the last finger bouncing events and can not be heard.


With all that said, in the end you just need to add a single line of properties to the parent layout of these buttons.


Android:splitmotionevents= "true"

Some people say this is called whether Global multitouch is supported, false is not supported, true is supported.

And I think this is to see if you want to divert the touch event to each corresponding control.


Sometimes know less, it becomes the time cost!!


Android presses multiple buttons at the same time

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.