Android Custom Viewswipebackhelper for left-sliding end activity

Source: Internet
Author: User

 

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

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.