
根据item_type类型不同来实现给RecyclerView加头部的效果
判断是否滑动到最后一条来实现加载更多,其实也是根据item_type不同来实现
下拉刷新谷歌有原生的swiperefreshlayout
接下来讲addheaderview最关键的部分了,小伙伴们看好了--首先添加依赖库:
compile 'com.bartoszlipinski.recyclerviewheader:library:1.2.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
接下来实现布局文件编写:<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal|top" />
<com.bartoszlipinski.recyclerviewheader.RecyclerViewHeader
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="center_horizontal|top">
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:src="@mipmap/ic_launcher"/>
</com.bartoszlipinski.recyclerviewheader.RecyclerViewHeader>
</FrameLayout>最后只需要在代码中设置完adapter之后,调用attachto方法即可实现了核心代码就这么点:header = (RecyclerViewHeader) findViewById(R.id.header)
recyclerView = (RecyclerView) findViewById(R.id.recycler)
mAdapter = new MyAdapter(this, mDatas, R.layout.template_text)
recyclerView.setAdapter(mAdapter)
recyclerView.setLayoutManager(new LinearLayoutManager(this))
header.attachTo(recyclerView, true)
recycle3个箭头。RECYCLE是可回收的意思,第一个箭头是废旧包装材料,第二个箭头是优质环保的产品,第三个箭头代表人类的参与,三个箭头形成一个环,表示可以循环利用。
为了提供纸类产品一个回收的管道,1991年7月2日,由德国瓦楞纸工业总会、包装及瓦楞纸联盟及贵重原料再生公司联盟共同决议,建立再生系统回收制度,创设在生系统公司。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)