本项目主要listview实现各类版面设计功能,有实现列表的,gridview效果的,有混排效果的等等。
自定义TwoWayView继承RecyclerView,经过TwoWayView去根据布局实现到底选择哪个效果,
本项目来自:https://github.com/lucasr/twoway-view
listview代码部分:
<org.lucasr.twowayview.widget.TwoWayView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/TwoWayView"
app:twowayview_layoutManager="ListLayoutManager"/>html
实现gradview效果:
<org.lucasr.twowayview.widget.TwoWayView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/TwoWayView"
app:twowayview_layoutManager="GridLayoutManager"
app:twowayview_numColumns="3"
app:twowayview_numRows="3" />android
实现混排效果:
<org.lucasr.twowayview.widget.TwoWayView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/TwoWayView"
app:twowayview_layoutManager="StaggeredGridLayoutManager"
app:twowayview_numColumns="2"
app:twowayview_numRows="2" />git
项目源码:http://www.itlanbao.com/code/20151023/10000/100592.htmlgithub