Giter Site home page Giter Site logo

sideslipentry's Introduction

SideSlipEntry

侧滑进入

效果图

控件如果想实现从右侧滑入的效果,可以绑定此Behavior 并添加到CoordinatorLayout布局中,方可实现从右侧滑入的效果,并支持嵌套滑动。

示例:

<ViewGroup
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      android:layout_marginBottom="16dp"
      app:fitToContents="false"
      app:halfable="true"
      app:hideable="true"
      app:layout_behavior="com.qgswsg.side_slip_entry.SideSlipEntryBehavior"
      app:smallTailMovedOut="true"
      app:smallTailWidth="50dp"
      app:smallTailView="@id/smallTailView"
      tools:ignore="MissingPrefix">
            ...
</ViewGroup>

最后记得在根标签中添加 xmlns:app="http://schemas.android.com/apk/res-auto"

另外: ViewPager和HorizontalScrollView也算是可以水平滑动的控件,但它们并没有实现NestedScrollingChild相关接口。 因此本Behavior是不支持与ViewPager和HorizontalScrollView嵌套滑动的,如果想实现它们的嵌套滑动, 可继承ViewPager或HorizontalScrollView实现NestedScrollingChild相关接口,并重写它们的onTouchEvent和onInterceptTouchEvent相关方法, 使之将滑动事件分享出来。

下边给出相关属性说明表

属性(attr) 格式(format) 说明(Description)
smallTailWidth dimension “小尾巴”的宽度,就是停靠在最右边时,露出来部分的宽度
hideable boolean 是否可以被完全滑出右边界隐藏起来;此属性只针对滑动,如果代码中直接设置隐藏,将忽略此属性
fitToContents boolean 为true时,控件所有内容都被显示了就不能再往左滑动了;否则一直能滑动到左边界;如果设置了smallTailMovedOut=true 此属性将失效
smallTailMovedOut boolean 为true时,“小尾巴”部分将允许完全滑动到左边界之外;否则滑动到左边界就会停
halfable boolean 为true时,允许在屏幕水平方向中间停靠
smallTailView reference 指定“小尾巴”控件的id,指定控件id后,只会获取被指定控件的宽度,并且smallTailWidth属性将无效

依赖

implementation 'com.qgswsg.side_slip_entry:SideSlipEntry:1.5'

sideslipentry's People

Contributors

qgswsg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

liushuiguang

sideslipentry's Issues

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.