Reprint Blog Address: http://www.cnblogs.com/flyme2012/p/4106308.html
Idle nothing to do a little thing. Android is sliding up or down, showing the underlying layout. Can do similar to the QQ message list deletion function.
Look at the effect:
The realization of the basic principle: the previous period of time to learn the Viewdraghelper class, probably through this class to control the sliding of the left and right, convenient many Ah, is also very simple code, you can refer to my previous about Viewdraghelper blog post, The main thing to do here is to pass on the touch event, which needs to pass the touch event to the underlying layout. @Override Public boolean dispatchtouchevent (motionevent ev) { switch (ev.getaction ()) { Case motionevent. Action_down: StartX = (int) ev.getx (); starty = (int) ev.gety (); if (bottomstate = = Defult_bottom | | Bottomstate = = defult_top) { bottomview.dispatchtouchevent (EV); } topview.dispatchtouchevent (EV); Break ; Case motionevent. ACTION_UP: int moveX2 = (int) ev.getx (); int moveY2 = (int) ev.gety (); if (Math. ABS ((moveY2- starty)) < 8) { if (Getstatusstate () == status.open && (bottomstate == defult_bottom | | bottomstate = = Defult_top bottomview.dispatchtouchevent (EV); }Else if (getstatusstate () = = Status. Close) { topview.dispatchtouchevent (EV); }}else { ontouchevent (EV); return true; }Break ; } return super.dispatchtouchevent (EV); } SOURCE Address: Http://pan.baidu.com/s/1c0q2VRy My github address: https://github.com/flyme2012 My blog address: http://www.cnblogs.com/flyme2012/
Android swipe up or down to show the underlying layout