Giter Club home page Giter Club logo

androidelasticview's Introduction

AndroidElasticView Build Status

弹性View,像IOS中的效果。

开始使用

引入库

Gradle

dependencies {
    compile 'co.lujun:androidelasticview:1.0.9'
}

本地导入androidelasticview使用

######1、导入androidelasticview ######2、在Project下的settings.gradle中添加include ':androidelasticview' ######3、使用该库的Module/build.gradle中dependencies语句添加compile project(':androidelasticview')

使用

命名空间:xmlns:app="http://schemas.android.com/apk/res-auto" 提供两个自定义属性:

  • app:elastic_factor (弹性因子,float类型,所有View都可以使用)
  • app:anim_duration (回弹时间,integer类型,仅供ElasticScrollView使用,其他无效)

ElasticListView

<co.lujun.androidelasticview.ElasticListView
    android:id="@+id/listview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:elastic_factor="0.5" />
ElasticListView listView;
// 获取偏移量, type:0-下拉,1-上拉; offset-偏移量
listView.setOffsetChangeListener(new OnOffsetChangedListener() {
    @Override
    public void onOffsetChanged(int type, int offset) {
        Log.d(TAG, "type=" + type + ", offset=" + offset);
    }
});
// 容错处理抽取数目
listView.setErrorContainerNum(3);
// 获取列表滑动方向, isScrollToUp-true(手势向上滑)-false(手势向下滑)
listView.setScrollDirectionListener(new OnDirectionChangedListener() {
    @Override
    public void onDirectionChanged(boolean isScrollToUp) {
        Log.d(TAG, "isScrollToUp=" + isScrollToUp);
    }
});
//获取Gesture Fling手势方向
// 0-fling top, 1-fling bottom, 2-fling left, 3-fling right
listView.setGestureChangedListener(new OnGestureChangedListener() {
    @Override
    public void onGestureChanged(int gesture) {
        Log.d(TAG, "gesture=" + gesture);
    }
});
// 按下拉动过程中是否放开
listView.isUp();

ElasticScrollView

<co.lujun.androidelasticview.ElasticScrollView
    android:id="@+id/scrollview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:elastic_factor="0.5"
    app:anim_duration="300">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <!-- child view-->

        <!-- end child view-->
    </LinearLayout>
</co.lujun.androidelasticview.ElasticScrollView>

ElasticRecycleView(Deprecated)

SAMPLE

sample apk下载

About

ElasticScrollView原文实现方式(Android上实现仿IOS弹性ScrollView)

有任何问题,email me.

License

Copyright (c) 2015 lujun

Licensed under the Apache License, Version 2.0

androidelasticview's People

Contributors

whilu avatar

Watchers

Shrenik Shah 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.