【发布时间】:2013-10-13 18:42:25
【问题描述】:
我正在尝试在列表视图的底部添加两个按钮:
footerView = ((LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.page_navigation, null, false);
listView = (ListView) findViewById(R.id.list);
listView.addFooterView(footerView);
到目前为止,我没有问题,但是当我试图操纵 footerview 元素的可见性时,我得到了一个空指针异常。根据其他问题的答案,也许使用片段是一个更好的解决方案。任何想法如何做到这一点
nextPage = (Button) findViewById(R.id.next);
previousPage = (Button) findViewById(R.id.prev);
mainNav = (Button) findViewById(R.id.previousNext);
上面的按钮是footerView 元素,我正在尝试控制它们的可见性并更新listView 项目以响应单击此按钮(我的意思是可以回调此按钮吗?)
在此先感谢,请原谅我的英语不好
【问题讨论】:
标签: android android-layout android-listview android-button