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

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐