Git开源地址
https://github.com/YaphetZhao/PullScrollView
演示Mp4:https://github.com/YaphetZhao/PullScrollView/blob/master/preview/Preview.mp4
PullScrollView
支持下拉手势的ScrollView,提供监听回调,代码清晰,可根据情况自行修改
项目采用Kotlin进行编写,演示请看 */preview/Preview.mp4
xml添加View
<com.yaphetzhao.zy_pullscrollview.PullScrollView
android:id="@+id/main_pullscrollview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
回调监听
main_pullscrollview.addPullScrollChangeListener(object : PullScrollView.PullScrollViewChangeListener {
override fun refreshScrollChanged() {
//TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
//用户正在滑动过程中
}
override fun refreshRefreshing() {
//TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
//滑动完了,并且大于响应事件的临界值,此时执行事件
Toast.makeText(this@MainActivity, "YaphetZhao-PullScrollView Refreshing", Toast.LENGTH_SHORT).show()
}
})
PullScrollView addViews
for (i in 0..19) {
main_pullscrollview.addContainer(getCustomView())
}
更多请看PullScrollView源码
How to Use
粘贴/zy_pullscrollview/src/main/java/com/yaphetzhao/zy_pullscrollview/PullScrollView.kt
和相应的资源文件到你的项目吧,compile没必要,而且你肯定有很多东西要改(比如Header,阀值等),放一堆属性,我麻烦你也麻烦
YaphetZhao
QQ 11613371
Email yaphetzhao@foxmail.com
网友评论