Skip to content

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

Open

Description

@FlyingFeeling
No description provided.

Activity

  1. xiangcman commented on Oct 23, 2017

    @xiangcman
    Owner

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

  2. FlyingFeeling commented on Oct 23, 2017

    @FlyingFeeling
    Author

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

  3. FlyingFeeling commented on Oct 23, 2017

    @FlyingFeeling
    Author
  4. xiangcman commented on Oct 23, 2017

    @xiangcman
    Owner

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

  5. FlyingFeeling commented on Oct 23, 2017

    @FlyingFeeling
    Author
  6. xiangcman commented on Oct 23, 2017

    @xiangcman
    Owner

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

  7. FlyingFeeling commented on Oct 23, 2017

    @FlyingFeeling
    Author
  8. xiangcman commented on Oct 23, 2017

    @xiangcman
    Owner

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

  9. FlyingFeeling commented on Oct 23, 2017

    @FlyingFeeling
    Author
  10. FlyingFeeling commented on Oct 23, 2017

    @FlyingFeeling
    Author
  11. xiangcman commented on Oct 23, 2017

    @xiangcman
    Owner

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

  12. FlyingFeeling commented on Oct 23, 2017

    @FlyingFeeling
    Author
  13. FlyingFeeling commented on Oct 23, 2017

    @FlyingFeeling
    Author

    可以了!谢谢了!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions