NestedScrollView嵌套RecyclerView出现onBindViewHolder一直回调的问题

CoordinatorLayout中NestedScrollView嵌套RecyclerView出现onBindViewHolder的回调问题:
假设数据有860条,在初始化后显示一屏不滑动,onBindViewHolder 回调12次,
而嵌套了则在初始化后不滑动的情况下会回调860次,APP崩了。。。

2016年11月20日01:18:06补充

//设置 这个可以避免以上问题    但也意味着失去了本身设计用来提供支持WRAP_CONTENT的功能了
mRecyclerView.getLayoutManager().setAutoMeasureEnabled(false);

api要点:

1、This method is usually called by the LayoutManager with value true if it wants to support WRAP_CONTENT.

通常调用这个方法设置值为true的时候 就是用来支持WRAP_CONTENT功能的。。。

2、 True if the Layout should be measured by the RecyclerView, false if the LayoutManager wants to measure itself.

true 代表把布局交由recycleview测量 false 代表LayoutManager 自己测量

api 24.2.1

public void setAutoMeasureEnabled(boolean enabled)
Defines whether the layout should be measured by the RecyclerView or the LayoutManager wants to handle the layout measurements itself.
This method is usually called by the LayoutManager with value true if it wants to support WRAP_CONTENT. If you are using a public LayoutManager but want to customize the measurement logic, you can call this method with false and override LayoutMana
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值