标签:
利用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);
标签:
原文地址:http://www.cnblogs.com/xushihai/p/4582885.html