本文介绍了ListView的getView()方法什么时候调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究 ListView.我想知道什么时候 getView() 被调用.设置适配器后是否调用它?一旦 getView() 方法完成执行,设置适配器"旁边的行是否会被调用?

I'm working on ListView. I want to know when exactly getView() is called. Is it called once the adapter is set? And does the line next to "setting adapter" get called once the getView() method completes execution?

请帮助我知道 getView() 执行完毕后执行哪一行.

Please help me know which line gets executed once the getView() finishes execution.

这对我很有帮助.

提前致谢,外教

推荐答案

getView() 为您传递给适配器的列表中的每个项目调用.当您设置适配器时会调用它.当 getView() 完成后,调用 setAdapter(myAdapter) 之后的下一行.为了调试 getView() 你必须在它上面切换断点,因为你不能从 setAdapter(myAdapter) 进入 getView().getView() 也会在 notifyDataSetChanged() 之后和滚动时调用.

getView() is called for each item in the list you pass to your adapter.It is called when you set adapter. When getView() is finished the next line after setAdapter(myAdapter) is called.In order to debug getView() you must toggle a breakpoint on it because you can't step into getView() from setAdapter(myAdapter).getView() is also called after notifyDataSetChanged() and on scrolling.

这篇关于ListView的getView()方法什么时候调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 23:31