Giter Club home page Giter Club logo

scrollitem's Introduction

ScrollItem

ScrollItem是仿照IOS滑动时显示删除按钮而封装的一个ItemView

ScrollItem默认包含有一个删除按钮,可以通过setDeleteListener设置删除回调。ScrollItem支持在XML文件或Java代码中传入一个顶层布局,ScrollItem实现了该顶层 布局的对滑动的响应规则,与外部AbsListView的滑动冲突,并自动响应删除按钮的删除事件。

滑动规则:ScrollItem只能进行左滑,当左滑距离小于删除按钮宽度时会取消这次滑动,否则自动滑动到删除按钮左侧

处理滑动冲突的规则:纵向滑动时外部控件才允许拦截事件,ScrollItem在滑动时不允许拦截滑动事件

对点击事件的处理:滑动距离小于10px时认为是点击事件,会交给顶层子布局处理,在删除按钮范围内滑动会认为是点击事件,交给删除按钮去处理

在使用ScrollItem时,需要额外处理ListView/RecyclerView对ScrollItem的复用导致的问题,以及不同ScrollItem之间的交互(比如滑动一个Item,前面的Item会关闭), ScrollItem提供了setOnScrollListener和resetViewSmoothly方法来处理以上问题。

scrollitem's People

Contributors

mindself avatar

Watchers

 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.