轉(zhuǎn)載:https://mp.weixin.qq.com/s/59YLxK8C5IGwwpZ9P8NjZw
摘要:自從RecyclerView推出后同波,其LayoutManager對(duì)布局的靈活控制是讓開發(fā)者們稱贊不已窗市。
Google默認(rèn)為RecyclerView提供了LinearLayoutManager子檀、StaggeredGridLayoutManager、GridLayoutManager藐鹤,已經(jīng)可以滿足很多開發(fā)需求了抽兆,但是實(shí)際開發(fā)過程中,免不了出現(xiàn)一些更加新穎的交互設(shè)計(jì)蹂安。于是椭迎,便從Github上整理了一波關(guān)于RecyclerView可以使用的LayoutManager,在實(shí)際開發(fā)中需要用到時(shí)田盈,遇到相似的效果時(shí)即可隨手拈來畜号,提高效率。
1 FanLayoutManager
https://github.com/Cleveroad/FanLayoutManager
來自國(guó)外一家名為Cleveroad的科技公司的開源作品允瞧,因其效果就像風(fēng)扇扇葉旋轉(zhuǎn)一樣简软,所以名中帶Fan。效果不錯(cuò)瓷式,API上也有很多的配置參數(shù)替饿,用起來還是挺靈活的语泽。
2 CarouselLayoutManager
https://github.com/Azoft/CarouselLayoutManager
讓你的RecyclerView秀出傳送帶效果贸典,支持橫向和縱向兩種選擇。
3 ChipsLayoutManager
https://github.com/BelooS/ChipsLayoutManager
一種流式布局的效果踱卵,很像我們平時(shí)看到的標(biāo)簽云廊驼。該庫(kù)同樣提供了很多可配置效果的API,并且支持多種多花效果惋砂。
4 HiveLayoutManager
https://github.com/Chacojack/HiveLayoutManager
國(guó)人寫的一個(gè)蜂巢布局管理器妒挎,除了外觀帥氣外,其增刪查改的動(dòng)畫效果也是很贊的西饵。
5 vlayout
https://github.com/alibaba/vlayout
vlayout 是手機(jī)天貓 Android 版內(nèi)廣泛使用的一個(gè)基礎(chǔ) UI 框架項(xiàng)目酝掩,提供了一個(gè)用于 RecyclerView 的自定義的 LayoutManger,可以實(shí)現(xiàn)不同布局格式的混排眷柔,目標(biāo)是支撐客戶端 native 頁(yè)面的快速開發(fā)期虾,它也是 Tangram 框架的基礎(chǔ)模塊。
6 flexbox-layout
https://github.com/google/flexbox-layout
flexbox-layout是Google開源的布局驯嘱,其效果是實(shí)現(xiàn)類似CSS中的Flexbox布局效果(具體可看:https://www.w3cplus.com/css3/a-guide-to-flexbox-new.html)镶苞,原本并不支持RecyclerView,但其最新的Alpha版本已經(jīng)開始推出FlexboxLayoutManager用于支持RecyclerView實(shí)現(xiàn)效果鞠评。
7 LondonEyeLayoutManager
https://github.com/danylovolokh/LondonEyeLayoutManager
一個(gè)環(huán)形菜單的布局管理器茂蚓,以前在建行的Android客戶端就見過此效果,不過那時(shí)候是用ViewGroup實(shí)現(xiàn)的剃幌。
8 總結(jié)
好了聋涨,大致就推薦以上這些開源布局管理器。