ListView addHeaderView causes position to increase by one?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Below is a code snippet with a ListView. I added an emptyView and a headerView. Adding the headerView causes the position in the onItemClick to be increased by one. So without the headerView the first list element would have position 0, with the headerView the position of the first list element would be 1! This causes errors in my adapter, e.g. when calling getItem() and using some other methods, see below. Strange thing: In the getView() method of the adapter the first list element is requested with position 0 even if the headerView is