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