Add a header/footer in a listview in xml

android, footer, listview

Solution

No, I don't think that it is possible. Based on ListView source code there are only `overScrollHeader/overScrollFooter` are available from XML attributes. But these attributes accept only drawables.

If you don't want to use tricks with layouts above/below `ListView`. You can extend `ListView` and implement your own footer and header support in customized `View`. It is not so hard because of footer and header are already implemented. You only have to add XML attributes parsing in your customized View's constructor.

Problem

I know how to add a header or a footer in JAVA, but I was wondering if I could add it straight in the XML. I wouldn't want to simulate this, but really add it as footer or header!

Original source

Related problems