我在 listVivew 的标题中添加了一个视图,
View TopSearch = (View) View.inflate(this, R.layout.search, null);
lv.addHeaderView(TopSearch, null, false);
一切都很好,直到我尝试执行(当数据更改时)
adapter.notifyDataSetChanged();
这总是使我的应用程序崩溃,给我以下错误:
> java.lang.ClassCastException: android.widget.HeaderViewListAdapter
如果我删除标题视图,则没有错误。有什么建议么?谢谢。