Giter Club home page Giter Club logo

slideback's Introduction

SlideBack

一个让你的页面支持 滑动返回 的小东西

效果

示例

使用方法:

Step 1. 在你项目的根build.gradle中添加jitpack.io库

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. 添加SlideBack的依赖

dependencies {
    implementation 'com.github.ChenTianSaber:SlideBack:v0.8.2'
}

Step 3. 将项目中继承的Activity换成SlideBackActivity

public class YourActivity extends SlideBackActivity

Step 4. 你可以在onCreate方法中调用setSlideBackDirection,可以给每一个Activity单独配置,如果没有配置这个,那么默认是 SlideBackActivity.ALL

protected void onCreate(Bundle savedInstanceState) {
    //Other Code...

    //有三个值可以设置
    //SlideBackActivity.RIGHT  表示只能从屏幕右侧滑出
    //SlideBackActivity.LEFT  表示只能从屏幕左侧滑出
    //SlideBackActivity.ALL  表示从屏幕两边都可以滑出
    setSlideBackDirection(SlideBackActivity.RIGHT);
}

Step 5. 重写slideBackSuccess(当滑动有效时会回调这个方法,可以在这里进行回退操作或其他)

@Override
protected void slideBackSuccess() {
   finish();//或者其他
}

希望大家能给我Star...

slideback's People

Contributors

chentiansaber avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.