Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FlyingFeeling opened this issue Oct 23, 2017 · 13 comments

Comments

@FlyingFeeling
Copy link

No description provided.

@xiangcman
Copy link
Owner

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

@FlyingFeeling
Copy link
Author

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

@FlyingFeeling
Copy link
Author

FlyingFeeling commented Oct 23, 2017 via email

@xiangcman
Copy link
Owner

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

@FlyingFeeling
Copy link
Author

FlyingFeeling commented Oct 23, 2017 via email

@xiangcman
Copy link
Owner

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

@FlyingFeeling
Copy link
Author

FlyingFeeling commented Oct 23, 2017 via email

@xiangcman
Copy link
Owner

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

@FlyingFeeling
Copy link
Author

FlyingFeeling commented Oct 23, 2017 via email

@FlyingFeeling
Copy link
Author

FlyingFeeling commented Oct 23, 2017 via email

@xiangcman
Copy link
Owner

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

@FlyingFeeling
Copy link
Author

FlyingFeeling commented Oct 23, 2017 via email

@FlyingFeeling
Copy link
Author

可以了!谢谢了!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants