Listview count vs number of adapters in Android
•
Android
Why do listview. Getchildcount () and adapter. Getcount () return different values? I have an onscroll method. If I call the above methods, each method returns a different value. Who knows why?
resolvent:
Listview. Getchildcount() returns the number of views on the screen. Adapter getcount() returns the total number of objects in the list
getChildCount()
getCount()
You may have 50 strings representing arrayadapter, but currently only 10 strings are drawn on the screen, so your listview count will be 10, but your adapter count will be 50
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码