標籤:android style blog http io ar color 使用 sp
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
[轉]android中最好的瀑布流控制項PinterestLikeAdapterView