问题描述
我的RecyclerView
中有一个WebView
,每当我呼叫RecyclerView.notifyDataSetChanged
时,WebView
都会短暂闪烁.
I have a WebView
in my RecyclerView
, whenever I call RecyclerView.notifyDataSetChanged
the WebView
will have a short flashing.
我不希望WebView
发生任何变化,我该怎么做?
I don't want any changes happen on the WebView
, how can I do this ?
我知道我可以使用notifyItemXXX
而不是notifyDataSetChanged
来解决此问题.但是我确实需要notifyDataSetChanged
方法.
I know I can solve this with using notifyItemXXX
instead of notifyDataSetChanged
. But I do need notifyDataSetChanged
method.
推荐答案
notifyDataSetChanged()官方文档说:将迫使LayoutManagers完全重新绑定并重新布局所有可见视图."因此,我认为网络视图的闪烁是由此引起的.并且您可以找到此作为最后的手段依靠onnotifyDataSetChanged()".正如您提到的那样,您必须使用此方法,所以请您提供更多信息,以便我帮助您找到更好的解决方案.
As thenotifyDataSetChanged() official doc says "LayoutManagers will be forced to fully rebind and relayout all visible views.". So I think the webview's flash is caused by this. And you can find this "Rely onnotifyDataSetChanged() as a last resort.".As you mentioned you must use this method, so can you please give more info so I can help you to find out a better solution.
这篇关于当notifyDataSetChanged时,RecyclerView中的WebView将闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!