[轉]android中最好的瀑布流控制項PinterestLikeAdapterView

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.