我有一个包含事件列表的 ListView,当我滚动列表时,我会加载更多项目,并且我的屏幕上始终没有超过 20 个事件可见。所以我这样进行:
//load data from server and add it to my eventsList
int size = eventsList.size();
List<Data> temp;
if(size>20) {
eventsList = eventsList.subList(size - 20, size);
}
Log.e("eventsList Load More", " " + eventsList.size() + " " + principalSchedule.getCount());
//Tell to the adapter that changes have been made, this will cause the list to refresh
principalSchedule.notifyDataSetChanged();
但问题我总是有 eventsList.size() = 20 并且 principalSchedule.getCount() 并没有减少。