"Android" big move, the container touch event to another container,!

Source: Internet
Author: User

Ideas:

1. Based on View.dispatchtouchevent


Role:

1. When clicked, pass the container point to the control that is not its child control,!

2. Pass the event to the activity below, through transparent activity or dialog!

Note:1> is also available through Motionevent.obtain (downtime, eventtime, action, X, Y, metaState), simulated events such as for booting,!


The container to be clicked:

public class Mylinearlayout extends LinearLayout {public mylinearlayout (Context arg0, AttributeSet arg1) {//TODO Auto-gen Erated Constructor Stubsuper (arg0, arg1);} @Overridepublic boolean onintercepttouchevent (motionevent ev) {//TODO auto-generated method stubmotionevent Event2 = Mot Ionevent.obtain (EV);//mainactivity.lltest is the target container, and a copy of the event is distributed to LlTestMainActivity.llTest.dispatchTouchEvent (EVENT2) ; return super.onintercepttouchevent (EV);}}


, when you click the left button, the event also passes to the right:







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.