GithubHelp home page GithubHelp logo

leaqi / swipedrawer Goto Github PK

View Code? Open in Web Editor NEW
55.0 1.0 13.0 17.17 MB

Android SwipeDrawer滑动抽屉库,支持上下左右四个方向,打开模式有抽屉、覆盖、固定三种,支持无限嵌套、边缘滑动等,SwipeDrawer还可以用来做下拉刷新,支持ListView、RecyclerView、GridView、ScrollView等。

Home Page: https://leaqi.github.io/SwipeDrawer

License: Apache License 2.0

Java 100.00%
android drag drawer java layout swipe view viewgroup swipedrawer

swipedrawer's Introduction

SwipeDrawer · Star Fork API JitPack Release License Download Demo Apk

中文 README | English README

Android SwipeDrawer滑动抽屉库,可同时添加上下左右四个方向抽屉布局,抽屉打开模式有抽屉模式、覆盖模式、固定模式三种,支持无限嵌套,支持边缘滑动打开等,SwipeDrawer还可以当做下拉刷新布局使用,支持ListView、RecyclerView、GridView、ScrollView等。

中文:

点击查看使用文档 点击查看功能详解 点击查看图片演示

English:

Click to view Use Docs Click to view Detailed Docs Click to view Picture Preview

开始使用

添加 jitpack 仓库地址:

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

添加 SwipeDrawer 依赖:

dependencies {
    ...
    implementation 'cn.Leaqi:SwipeDrawer:1.6'
}

在布局文件中加入 SwipeDrawer

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:leftLayout="@+id/leftDrawer">

    <!-- leftLayout属性指定Left布局 -->
    <LinearLayout
        android:id="@+id/leftDrawer"
        android:layout_width="200dp"
        android:layout_height="match_parent"
        android:background="#FF5722">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="Left" />
    </LinearLayout>

    <!-- 默认第一个未指定ID的布局为主布局 -->
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="Main" />
    </RelativeLayout>
</cn.leaqi.drawer.SwipeDrawer>

图片预览 · 查看更多

Demo Demo Demo Demo

License

Apache-2.0 License

Copyright (c) 2022 Leaqi

swipedrawer's People

Contributors

leaqi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

swipedrawer's Issues

强制手机横屏,view显示异常

手机在竖屏情况下没有问题,但是强制设置手机为横屏情况,这个view就只会显示一半了(可能跟手机的分辨率有关系)

滚动问题

NestedScrollView 套 recycler。 recycler在往下滑的过程中会和下拉刷新手势有冲突

默认关闭

大佬,我实在没找到哪里设置默认关闭,都是默认打开的。在onCreate里面调用了closeDrawer(),也没有关闭。

给作者点个赞

项目不仅优秀,而且文档很详细,给使用者很大的帮助。

请教个问题

你好,作者,首先感谢你开发了这个好用的第三方库,我在项目中已经使用了,但是遇到一个问题,请教指教一下,业务上,我使用的是单activity+多Fragment,所以activity上放了一个空的FrameLayout,承载着不同的Fragment,所以我在使用你的库改造后,大致下面这样
<cn.leaqi.drawer.SwipeDrawer
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mainLayout="@+id/mainDrawer"
app:topLayout="@+id/topDrawer">

<FrameLayout
    android:id="@+id/topDrawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</FrameLayout>

<FrameLayout
    android:id="@+id/mainDrawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</FrameLayout>

</cn.leaqi.drawer.SwipeDrawer>

首先这个top下拉的页面是一个没有滑动的页面,但是id为main,也就是之前我项目里面的空FrameLayout 里面承载的不同Fragment,有的是一个没有滑动的布局,有的是带有上下滑动的RecycleView,还有水平滑动的RecyclerView, 目前我使用你提供的api,可以做到主页没有滑动和水平滑动的 不会和top的Fragment全屏手势下拉冲突,但是带有垂直Recyclerview的fragment加载进去后,它的上下滑动就被top的手势抢占了, 我看有 mainScroll这个api,但是要指定子View的id,但是我的主页加载的Fragment是动态的,没发写死id
所以这种情况 该怎么处理,谢谢~

设置把手问题

你好,我通过1.5版本新加入的app:bottomOffset="50dp"功能设置拖曳把手,一切如预期效果。
但是发现一个问题,就是一个页面如果有多个方向的抽屉,那么在拖曳其他方向时,有把手方向上的抽屉会带着把手一起完全隐藏,就意味着app:bottomOffset="50dp"属性效果失效了,然而点击遮挡层关闭时,是会把把手露出在主页面的。请教请教,谢谢!!!

设置把手handle

您好!请问怎么设置把手handle,用于拖动上下拉之类的

能否支持抽屉自动隐藏

我现在做法不是很优雅

  1. 在 setOnDrawerSwitch -> onOpen 里开启定时器,超时则关闭抽屉
  2. leftLayout 用自定义的 LinearLayout 类,在 onDispatchTouch 事件中增加一个回调,遇到 ACTION_UP 或者 ACTION_CANCEL 则复位定时器

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.