GitHub地址:https://github.com/wenwenwen888/PullLoadMoreView
PullLoadMoreView
仿微信下拉显示小程序的控件(超简单实现)
先看预览图(转换后有一点点失真):
前言
项目需要做一个以前微信下拉显示小程序的效果,结果Google百度过并没有找到很多的开源库。而且实现方式还挺复杂,或者不适用于自己(大多数为需要ListView实现)
该库主要参考这篇文章?,实现的原理大家看这篇文章就好了,感谢该Po
-
在该篇文章的前提下,一共作出了以下修改
- 把Kotlin改为了Java
- 把可滑动控件的主布局改为了NestedScrollView(原文为ListView),按照原理,你可以改为任意一个可滑动的控件(但是需要您亲自下载library修改)
- 一些代码的优化,譬如
- NestedScrollView的布局直接在xml里实现
- 接口的添加和优化,使得更加方便
需要修改更多内容的可以下载library自行修改
有不妥之处请Issues指出,谢谢
Usage
With Gradle:
implementation 'com.wenwenwen888:pullloadmoreview:1.1.0'
How to use(直接clone项目查看demo更加直观哦)
一:xml主布局配置
<?xml version="1.0" encoding"utf-8"?>
<com.wenwenwen.view.PullLoadMoreView xmlns:android"http://schemas.android.com/apk/res/android"
xmlns:app"http://schemas.android.com/apk/res-auto"
android:id"@+id/pullLoadMoreView"
android:layout_width"match_parent"
android:layout_height"match_parent"
app:top_background_color"#fff">
<android.support.v4.widget.NestedScrollView
android"@+id/nestedScrollview"
android"match_parent"
android"wrap_content">
<LinearLayout
android"match_parent"
android"wrap_content"
android:orientation"vertical">
TextView
android"match_parent"
android"300dp"
android:gravity"center"
android:text"test1" /"test2" "test3" "test4" /LinearLayout/android.support.v4.widget.NestedScrollView>
/com.wenwenwen.view.PullLoadMoreView>
app"#fff"
二: 头部xml的配置
三:可设置回调监听
https://github.com/wenwenwen888/PullLoadMoreView (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|