首页 > 移动平台 > 详细

listview实现各种版面设计功能

时间:2015-11-11 10:05:22      阅读:358      评论:0      收藏:0      [点我收藏+]

本项目主要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"/>

实现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" />

实现混排效果:
<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" />

 

运行效果:

listview实现各种版面设计功能

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!