Giter Site home page Giter Site logo

waterfall4android's Introduction

waterfall4android

android瀑布流

#android 瀑布流的实现详解,附源码#

##介绍##

参考自:https://github.com/dodola/android_waterfall,因为原来的代码封装不好,所以,我根据源码的思路,重新写了一遍,所以有了现在这个项目:https://github.com/youxilua/waterfall4android

原作者表示:

试过在1万张可以流畅的滑动,不出现内存溢出情况

##设计思路##

之前的作者的自定义view 只有主滑动一层,其他的设置要在相应的活动设置,个人觉得,重用起来比较麻烦,所以决定封装一层.现在定义一个默认的瀑布流只需5步,以下为源码示意,具体,看源码...

//1 初始化waterfall

waterfall_scroll = (WaterFallView) findViewById(R.id.waterfall_scroll);

//2 初始化显示容器

waterfall_container = (LinearLayout) findViewById(R.id.waterfall_container);

//3,设置滚动监听

waterfall_scroll.setOnScrollListener(this);

//4,实例一个设置

WaterFallOption fallOption = new WaterFallOption(waterfall_container, 每列宽度, 列数);

//5,提交更改,实现android瀑布流

waterfall_scroll.commitWaterFall(fallOption, waterfall_scroll);

最后不要忘了监听滚动到底部的监听

@Override public void onBottom() { AddItemToContainer(++(waterfall_scroll.current_page), waterfall_scroll.pageCount); }

##已知bug## 这里出现的bug,原来的也有...

  • 滚动过快,导致部分图片无法显示

##功能加强##

  • 实现支持URL的方式加载图片

waterfall4android's People

Contributors

renyuan avatar youxilua avatar

Watchers

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