当前位置: 首页 > 软件库 > 手机/移动开发 > >

SwipeBack

授权协议 Apache-2.0 License
开发语言 Java
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 轩辕乐邦
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

SwipeBack

SwipeBack is a android library that can finish a activity by using gesture.

You can set the swipe direction,such as left,top,right and bottom.

Screenshots

Sample Download

Sample Download

Usage

Gradle

dependencies {
   	compile 'com.github.liuguangqiang.swipeback:library:1.0.2@aar'
}

Maven

<dependency>
  	<groupId>com.github.liuguangqiang.swipeback</groupId>
  	<artifactId>library</artifactId>
  	<version>1.0.2</version>
  	<type>aar</type>
</dependency>

SwipeBackActivity

SwipeBackActivity is a base activity for using this library more easier.This Activity will help us to show a shadow.

public class CommonActivity extends SwipeBackActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_common);
        setDragEdge(SwipeBackLayout.DragEdge.LEFT);
    }

}

Layout and activity theme.

SwipeBackLayout must contains only one direct child.

<com.liuguangqiang.swipeback.SwipeBackLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swipeBackLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
	
	<!-- SwipeBackLayout must contains only one direct child -->

</com.liuguangqiang.swipeback.SwipeBackLayout>
 <style name="Theme.Swipe.Back" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
 </style>

Swipe Direction

You can set DragEdge to change the swipe direction.

 public enum DragEdge {
      	LEFT,
      	
        TOP,
        
        RIGHT,
        
        BOTTOM
    }

Support Views

SwipeBackLayout must contains only one direct child.

Such as:

  • LinearLayout,
  • RelativeLayout,
  • ListView,
  • ViewPager
  • WebView

License

Copyright 2015 Eric Liu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
  • 1. 知识背景 项目中常用的侧滑返回控件大部分都是通过内部封装ViewDragHelper进行View拖拽实现的,而采用ViewDragHelper的方式必然会带来另外两个问题: Q1:什么样的右滑才是退出界面,而不是滑动界面内容? A1:ViewDragHelper传入参数View作为ControllerView,通过改变它的布局参数实现拖拽效果。为了达到Activity右滑返回的能力,那么Co

  • SwipeBack侧滑开源组件冲突问题处理 SwipeBack github地址:https://github.com/zhibuyu/SwipeBackDemo 智能手机的大屏化,使得单手操作和侧滑返回这两个功能成为了移动开发中常见的需求,本文说的就是侧滑开源组件SwipeBack在常见布局中的一些冲突问题。 常见问题: Editext滑动冲突 RecyclerView滑动冲突 1.Editex

 相关资料
  • 本文向大家介绍Android中SwipeBack实现右滑返回效果,包括了Android中SwipeBack实现右滑返回效果的使用技巧和注意事项,需要的朋友参考一下 现在有很多App支持右滑返回,比如知乎,效果比较赞。 于是自己对Activity和Fragment进行了继承,派生出SwipeBackActivity和SwipeBackFragment,用于对这种效果的实现,也就是只要继承这两个类就可

  • SwipeBackLayout 是一个支持屏幕上下左右滑动返回上层 Activity, 关闭当前 Activity, 类似简书 App。 效果图: 示例代码: public class DemoActivity extends SwipeBackActivity implements View.OnClickListener {    private int[] mBgColors;    pri