Git sees a swipebacklayout-based implementation that allows us to take back the button and improve the user experience without using the physical return key in the process.
Package Structure:
Operating effect:
How do I use?
Gradle
‘com.jude:swipebackhelper:1.1.5‘
Or you can do it yourself under the source pressure jar bag.
How do I use it?
In the following 3 activity lives, it is recommended to customize a baseactivity and then inherit this activity to save a lot of code by invoking the corresponding create method of some columns.
@Override protected void Span class= "Hljs-title" >oncreate (Bundle savedinstancestate) {super.oncreate ( Savedinstancestate); Swipebackhelper.oncreate (this);} @Override protected void Span class= "Hljs-title" >onpostcreate (Bundle savedinstancestate) {super.onpostcreate ( Savedinstancestate); Swipebackhelper.onpostcreate (this);} @Override protected void Span class= "Hljs-title" >ondestroy () {super.ondestroy (); Swipebackhelper.ondestroy (this);
How do I initialize some of my animation parameters?
In the OnCreate method initialization
Swipebackhelper.getcurrentpage (ThisGets the current page. Setswipebackenable (TrueSets whether to slide. Setswipeedge (200)The range that can be slid. Px. 200 is the screen for the left 200px. Setswipeedgepercent (0.2f)The range that can be slid. Percentage. 0.2 is represented as the screen on the left 20%. Setswipesensitivity (0.5f)The degree of sensitivity to lateral swipe gestures. 0 is sensitive to insensitive 1. Setscrimcolor (Color.Blue)Bottom shadow color. Setclosepercent (0.8f)The percentage of activity that triggered shutdown. setswiperelateenable (FalseWhether it is linked to the next level of activity. The default is. Setswiperelateoffset (500) //activity The offset at the time of linkage. Default 500px: AddListener (new Swipelistener () {//swipe listener @Override public void onscroll (float Percent, int px) {//sliding percent and distance} @Override public void Onedgetouch () {//when starting sliding} @Ov Erride public void onscrolltoclose () {//when Sliding close}});
Use is very simple, to achieve about 10 classes, the source has
Source Address: http://yunpan.cn/cm8HU6tsIcNRt access password E3DC
Reference address
- Previous Android version, page split line implementation Linearlayoutcompat layout simple case
- Next Android MoveTo, LineTo, Quadto, Cubicto, ArcTo detailed (Turn)
Android Custom Viewswipebackhelper for left-sliding end activity