LayoutManager-FlowLayout icon indicating copy to clipboard operation
LayoutManager-FlowLayout copied to clipboard

adapter不能数据更新,调用notifyDataSetChanged()方法布局错乱!

Open FlyingFeeling opened this issue 8 years ago • 13 comments

FlyingFeeling avatar Oct 23 '17 08:10 FlyingFeeling

你当前是使用1.2的版本不,之前是有错乱问题,在新的版本已经解决,方便看下你的代码不

xiangcman avatar Oct 23 '17 08:10 xiangcman

1 在这设置的Adapter 然后添加一个数据刷新adapter。 typeDatas.add("你好!"); adapter.notifyDataSetChanged(); view.setVisibility(View.INVISIBLE);

FlyingFeeling avatar Oct 23 '17 09:10 FlyingFeeling

设置manager

刷新adapter ------------------ 原始邮件 ------------------ 发件人: "随风者";[email protected]; 发送时间: 2017年10月23日(星期一) 下午4:57 收件人: "1002326270xc/LayoutManager-FlowLayout"[email protected]; 抄送: "斌斌"[email protected]; "Author"[email protected]; 主题: Re: [1002326270xc/LayoutManager-FlowLayout] adapter不能数据更新,调用notifyDataSetChanged()方法布局错乱! (#12)

你当前是使用1.2的版本不,之前是有错乱问题,在新的版本已经解决,方便看下你的代码不

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

FlyingFeeling avatar Oct 23 '17 09:10 FlyingFeeling

你这里没见你设置item的间距啊,能看下你的完整点的代码吗,你可以看下TextFlowActivity对数据的刷新是怎么使用的。

xiangcman avatar Oct 23 '17 09:10 xiangcman

间距我直接用padding填充了!我没有编译您的库到我的工程,而是拷贝您的文件到我的项目中去的!不知道您GitHub上是不是1.2版本的!

------------------ 原始邮件 ------------------ 发件人: "随风者";[email protected]; 发送时间: 2017年10月23日(星期一) 下午5:18 收件人: "1002326270xc/LayoutManager-FlowLayout"[email protected]; 抄送: "斌斌"[email protected]; "Author"[email protected]; 主题: Re: [1002326270xc/LayoutManager-FlowLayout] adapter不能数据更新,调用notifyDataSetChanged()方法布局错乱! (#12)

你这里没见你设置item的间距啊,能看下你的完整点的代码吗,你可以看下TextFlowActivity对数据的刷新是怎么使用的。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

FlyingFeeling avatar Oct 23 '17 09:10 FlyingFeeling

flowmanager里面设置item的间距是通过recyclerView.addItemDecoration(new SpaceItemDecoration(dp2px(10)));来实现的,你这里的padding值是item的内间距吧。item是需要外间距的啊。github上面是最新的版本。

xiangcman avatar Oct 23 '17 09:10 xiangcman

我看了一下您的刷新逻辑了,需要先清空数据,再重新填充数据。我试一试!

------------------ 原始邮件 ------------------ 发件人: "随风者";[email protected]; 发送时间: 2017年10月23日(星期一) 下午5:28 收件人: "1002326270xc/LayoutManager-FlowLayout"[email protected]; 抄送: "斌斌"[email protected]; "Author"[email protected]; 主题: Re: [1002326270xc/LayoutManager-FlowLayout] adapter不能数据更新,调用notifyDataSetChanged()方法布局错乱! (#12)

flowmanager里面设置item的间距是通过recyclerView.addItemDecoration(new SpaceItemDecoration(dp2px(10)));来实现的,你这里的padding值是item的内间距吧。item是需要外间距的啊。github上面是最新的版本。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

FlyingFeeling avatar Oct 23 '17 09:10 FlyingFeeling

不是说先清空数据,这里只是演示清空的一种情况,你也可以直接进行添加的,不要被误导了。

xiangcman avatar Oct 23 '17 09:10 xiangcman

我刚才试了一下:当把数据添加在最后一项的时候没有问题,但当把数据添加在数据中间,比如倒数第二项中就出现错乱! ------------------ 原始邮件 ------------------ 发件人: "随风者";[email protected]; 发送时间: 2017年10月23日(星期一) 下午5:32 收件人: "1002326270xc/LayoutManager-FlowLayout"[email protected]; 抄送: "斌斌"[email protected]; "Author"[email protected]; 主题: Re: [1002326270xc/LayoutManager-FlowLayout] adapter不能数据更新,调用notifyDataSetChanged()方法布局错乱! (#12)

不是说先清空数据,这里只是演示清空的一种情况,你也可以直接进行添加的,不要被误导了。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

FlyingFeeling avatar Oct 23 '17 09:10 FlyingFeeling

我刚才试了一下:当把数据添加在最后一项的时候没有问题,但当把数据添加在数据中间,比如倒数第二项中就出现错乱!

------------------ 原始邮件 ------------------ 发件人: "随风者";[email protected]; 发送时间: 2017年10月23日(星期一) 下午5:32 收件人: "1002326270xc/LayoutManager-FlowLayout"[email protected]; 抄送: "斌斌"[email protected]; "Author"[email protected]; 主题: Re: [1002326270xc/LayoutManager-FlowLayout] adapter不能数据更新,调用notifyDataSetChanged()方法布局错乱! (#12)

不是说先清空数据,这里只是演示清空的一种情况,你也可以直接进行添加的,不要被误导了。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

FlyingFeeling avatar Oct 23 '17 09:10 FlyingFeeling

这个刚发现了,是初始化的时候没对整个页面进行remove初始化导致的,在onLayoutChildren初始化的时候调用下removeAllViews就可以了

xiangcman avatar Oct 23 '17 09:10 xiangcman

好!我试一下!

------------------ 原始邮件 ------------------ 发件人: "随风者";[email protected]; 发送时间: 2017年10月23日(星期一) 下午5:52 收件人: "1002326270xc/LayoutManager-FlowLayout"[email protected]; 抄送: "斌斌"[email protected]; "Author"[email protected]; 主题: Re: [1002326270xc/LayoutManager-FlowLayout] adapter不能数据更新,调用notifyDataSetChanged()方法布局错乱! (#12)

这个刚发现了,是初始化的时候没对整个页面进行remove初始化导致的,在onLayoutChildren初始化的时候调用下removeAllViews就可以了

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

FlyingFeeling avatar Oct 23 '17 09:10 FlyingFeeling

可以了!谢谢了!

FlyingFeeling avatar Oct 23 '17 10:10 FlyingFeeling