我正在使用自定义listView并尝试添加页脚。然而,即使没有数据,页脚也会出现。我使用的代码如下:
View footer = View.inflate(this, R.layout.footer_xml, null);
listView.addFooterView(footer);
只有在列表非空时才有显示页脚的方法吗?此外,如果我以上述方式添加页脚,它似乎是OnItemClickListener中列表视图的一部分。我不希望这种情况发生,因为我只想在用户完全点击页脚图像时启动一些操作。 我知道我可以使用
ImageView b = (ImageView)footer.findViewById(R.id.my_list_button);
b.setOnClickListener(this);
但仅限于在listView的onItemClickListner中未触发任何操作。