Android ListView相关 头和尾 headView footerView

ListView还可以添加头和尾部,而这头和尾就是View对象,

可以使用listView.addHeadView(view)方法和listView.addFootView(view)方法分别添加头和尾。

注意,要在listView.setAdapter()方法之前调用以上两个添加方法。

        View header = View.inflate(this, R.layout.header, null);
        View footer = View.inflate(this, R.layout.footer, null);

        listView.addHeaderView(header);
        listView.addFooterView(footer);

 这个头和尾会根据listVIew滑动而滑动。

原文地址:https://www.cnblogs.com/wuyou/p/3649587.html