Implementation of android waterfall stream, with source code

Source: Internet
Author: User

Detailed Implementation of android waterfall stream, with source code Introduction

Reference: Workshop

Original Author:

I tried to slide smoothly on 10 thousand sheets without memory overflow.

Design Concept

650) this. width = 650; "style =" border-right-0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px "title =" Waterfall "border =" 0 "alt =" Waterfall "src =" http://img1.51cto.com/attachment/201209/21/3357586_1348212035rm9I.png "width =" 341 "height =" 484 "/>

Previously, the custom view of the author only slides one layer on the master, and other settings must be set on the corresponding activity. In my opinion, it is difficult to reuse, so I decided to encapsulate one layer. now it takes only five steps to define a default waterfall stream. The following shows the source code. For details, see the source code...

// 1 initialize waterfall

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

// 2 initialize the display container

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

// 3. Set the rolling listener

Waterfall_scroll.setOnScrollListener (this );

// 4. An instance setting

WaterFallOption fallOption = new WaterFallOption (waterfall_container, width of each column, number of columns );

// 5. Submit the changes to implement the android waterfall stream

Waterfall_scroll.commitWaterFall (fallOption, waterfall_scroll );

Finally, do not forget to scroll the listener to the bottom.

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

Known bugs

The bug here also exists...

  • Scrolling too fast, leading to the inability to display some images
Enhanced Functions
  • Supports URL-based image loading.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.