[转]android中最好的瀑布流控件PinterestLikeAdapterView

PinterestLikeAdapterView

项目地址:https://github.com/GDG-Korea/PinterestLikeAdapterView

使用方法类似于ListView下面是我使用该控件实现一个显示系统图片的简单应用:

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <merge xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:background="#000000"
 6      >
 7     <com.huewu.pla.lib.MultiColumnListView
 8         xmlns:pla="http://schemas.android.com/apk/res-auto"
 9         android:background="#000000"
10         android:id="@+id/list"
11         android:layout_width="match_parent"
12         android:layout_height="match_parent"
13         pla:plaColumnNumber="3"
14         pla:plaLandscapeColumnNumber="3"
15         >
16     </com.huewu.pla.lib.MultiColumnListView>
17 </merge>

plaColumnNumber表示显示多少列,plaLandscapeColumnNumber表示横屏下显示多少列。

但与StaggeredGridView 不同的是他没有提供设置item之间间隙大小的属性,这个可以通过在item的xml中设置一个padding来解决。

另外官方也有demo演示,不过他只是用TextView来实现了Pinterest的交错效果,这相比图片来说要简单的多,因为TextView只需设置不同长度的字符串就能得到不同高度的Item了。

我给的例子只是实现了Pinterest的交错效果,其实瀑布流往往是有上拉加载更多的功能的,这里有一个带有次功能的源码:http://download.csdn.net/detail/xiangxue336/7059861

和http://pan.baidu.com/s/1dDy8OUH

原文地址:http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2014/0919/1696.html

原文地址:https://www.cnblogs.com/liangstudyhome/p/4146724.html