Giter VIP home page Giter VIP logo

Comments (7)

chenenyu avatar chenenyu commented on May 27, 2024

是add还是addAll呢?

from superadapter.

MrTrying avatar MrTrying commented on May 27, 2024

我是用的是这个方法add(0,item),这个插入的数据是成功的,但是没有马上显示出来

具体的情况我描述一下,
情况一:当RecycleView中的item没有站满整个屏幕的时候,add(0,item)方法是有效的
情况二:当RecycleView中的item的数量比较多的时候,已经超出屏幕了,再调用add(0,item)方法时无法看到第一个item直接显示出来,当向下滑动RecycleView时,刚才加入的item会显示出来
情况三:当我使用mAdapter.addHeader(view)方法添加一个headerView之后,调用add(0,item)方法是没有任何问题的。

此外我i还在RecycleView的外层使用了该下拉刷新框架https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh

以上是我可以提供的信息。

from superadapter.

chenenyu avatar chenenyu commented on May 27, 2024

我等会测试一下,请稍候。谢谢反馈。

from superadapter.

chenenyu avatar chenenyu commented on May 27, 2024

您的意思是RecyclerView没有自动滚动上顶部吗?添加数据时,默认是不会改变可滚动控件的当前显示区域的。您可以在add(0, item)后使用recyclerView.scrollToPosition(0);来显示您插入的单条数据。

from superadapter.

MrTrying avatar MrTrying commented on May 27, 2024

可以了,谢谢!
但是这个问题是否可以在adapter的内部解决一下。

from superadapter.

chenenyu avatar chenenyu commented on May 27, 2024

每个人的需求都不一样,需要您自己处理哦。就比如addAll之后,列表不应该滚动到最后一样。

from superadapter.

MrTrying avatar MrTrying commented on May 27, 2024

有道理

from superadapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.