Giter Club home page Giter Club logo

dragview's Introduction

DragView

Using in unread messages in ListView. You can drag the unread message like QQ.

GIF

Layout

<?xml version="1.0" encoding="utf-8"?>
<com.mm.hant.dragview.widget.DragView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drag_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ListView
        android:id="@+id/list_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />


</com.mm.hant.dragview.widget.DragView>

###思路: 1,点击ListView item里的未读消息(TextView1)的时候,在DragView里添加跟未读消息一样的TextView2,同时隐藏TextView1。 2,移动的时候,绘制红色圆点和路径。 3,手指抬起的时候,根据离TextView1点的距离判断是否将TextView1移除。       Tips:TextView1需要重写,捕获action_down事件。如果用setOnClickListener来做,会消费掉点几事件,导致DragView无法捕获。 ###DragView的责任: 1,当ListView的未读消息TextView被电击的时候,new一个未读消息TextView并add到界面上。 2,绘制小红点和连接两个圆的中间部分。中间部分通过二阶贝塞儿曲线绘制。 3,监听KeyEvent事件,当ACTION_UP的时候回调。 ###使用:        参考demo代码。代码中都有写注释。

dragview's People

Contributors

zjdyhant avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.