Comments (8)
我即使仿造你代码也无法复现问题, 建议根据以下选项排查问题
- 升级你的BRV版本至最新
- 检查你PageRefreshLayout是否是rv的直接父容器
- 请删除
data.isEmpty
判断, addData内部会自行判断
示例代码
binding.page.onRefresh {
scope {
val data = Get<List<UserModel>>("list") {
param("page", index)
}.await()
addData(data) {
index < 100 // 最多加载100个
}
}
}.showLoading()
from brv.
@liangjingkanji 感谢回复
我通过多次测试并复现了这个问题
BRV是最新的1.3.31,完整代码如下:
class MainFragment : Fragment() {
lateinit var binding: FragmentMainBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
StateConfig.apply {
emptyLayout = R.layout.layout_empty // 配置全局的空布局
errorLayout = R.layout.layout_error // 配置全局的错误布局
loadingLayout = R.layout.layout_loading // 配置全局的加载中布局
}
val view = layoutInflater.inflate(
R.layout.fragment_main,
container,
false
)
binding = FragmentMainBinding.bind(
view
)
return view
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.rv.setup {
addType<String>(R.layout.item)
onBind {
}
}
binding.page.onRefresh {
scope {
addData(null) {
false
}
}
}.showLoading()
}
}
xml代码:
<?xml version="1.0" encoding="utf-8"?>
<com.drake.brv.PageRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/page"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.drake.brv.PageRefreshLayout>
from brv.
我再仔细查看
from brv.
还是没复现问题, 你fork本仓库直接在demo上复现然后通知我拉取你的仓库查看吧
from brv.
好的,感谢
from brv.
@liangjingkanji 问题已复现,请见 https://github.com/1115190769/BRV
需要向您说明的是:
1.使用的是viewBinding,非dataBinding
2.引入了Net联动
from brv.
好的, 我查看下
from brv.
你可以将布局文件xml使用layout
包裹以解决此问题. 建议直接使用DataBinding取代ViewBinding
from brv.
Related Issues (20)
- 开启混淆后,调用getBinding去反射时会崩溃 HOT 6
- 好像没有Node,树级 HOT 4
- nothing
- 选择模式 HOT 5
- 如何给更新header或者footer中的数据 HOT 1
- 真是一个优秀的RV框架,不过我想问当前框架是否支持嵌套Group接合局部空布局使用?即当一个组中的元素为0的时候就显示空布局? HOT 13
- Jitpack 上 StateLayout 1.4.1 消失,导致BRV 1.5.1 之前的版本不能同步 HOT 9
- 多对多类型 HOT 5
- Demo内置的Net3.5.8版本已经找不到 HOT 1
- 请教一下上拉加载中的状态变更和列表数据先后顺序的问题 HOT 5
- 首页多布局快速上下滑动时会有跟不上的情况 HOT 1
- 拖拽+脚布局 闪退 HOT 6
- 使用ViewBinding 在选择模式下的问题以及复现步骤 HOT 1
- PageRefreshLayout的setnomoredata出现的底部文字不对 HOT 2
- 部分一加手机上使用grid会出现Unable to create layer for RecyclerView HOT 2
- 无法下载sources HOT 2
- Staggered布局+header+分割线,addModels 后出现的问题 HOT 1
- 关于checkedAll(false)的一些问题 HOT 3
- 在下拉刷新上拉加载的网络请求中再次滑动页面会再次网络请求
- 求助,列表滑上滑下后发现item的Textview状态会自动改变 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brv.