首页 > 其他 > 详细

RecyclerView之LayoutManager

时间:2015-06-17 13:07:45      阅读:522      评论:0      收藏:0      [点我收藏+]

 

利用RecyclerView显示数据,搭配SwipeRefreshLayout下拉刷新,因此,RecyclerView的显示方向应该是由下往上的,即第一项显示在最下面,最后一项显示在最上面,每次刷新新增的数据都添加在最上面,
所以使用LinearLayoutManager(Context context, int orientation, boolean reverseLayout)构造函数
可以设置数据的显示方向,设置reverseLayout为true即显示方向由下而上

 

    /**
     * @param context       Current context, will be used to access resources.
     * @param orientation   Layout orientation. Should be {@link #HORIZONTAL} or {@link
     *                      #VERTICAL}.
     * @param reverseLayout When set to true, layouts from end to start.
     */
    public LinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
        setOrientation(orientation);
        setReverseLayout(reverseLayout);

 

RecyclerView之LayoutManager

原文:http://www.cnblogs.com/xushihai/p/4582885.html

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