Reproduced--android waterfall flow of the implementation of detailed, attached source

Source: Internet
Author: User

Introduced

Reference from: Https://github.com/dodola/android_waterfall, because the original code encapsulation is not good, so, I based on the source of ideas, re-wrote again, so there is now this project: https://github.com/ Youxilua/waterfall4android

The original author says:

Tried to slide smoothly in 10,000 sheets without a memory overflow condition

Design ideas

Before the author of the custom view only the main slide one layer, the other settings to the corresponding activity settings, the personal feel, reuse is more troublesome, so decided to encapsulate a layer. Now define a default waterfall flow only 5 steps, the following is the source code, specific, see the source ...

1 Initializing Waterfall

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

2 Initializing the Display container

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

3, set the scrolling monitor

waterfall_scroll.setOnScrollListener(this);

4, instance one setting

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

5. Commit changes to achieve Android waterfall stream

waterfall_scroll.commitWaterFall(fallOption, waterfall_scroll);

Finally, don't forget to listen to the scroll to the bottom of the monitor

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

Known bugs

Here the bug, the original also has ...

    • Scroll too fast to cause some pictures to not display
function enhancement
    • Implement a URL-enabled way to load a picture

Reproduced--android waterfall flow of the implementation of detailed, attached source

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.