Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable or not show any headers for StickyListHeaders from emilsjolander

I am using https://github.com/emilsjolander/StickyListHeaders as my primary listview for most of my app. I have put this listview in my one layout that I use for all my listviews. However, There are some instances when I don't want to show any headers, I just want to show a regular list, like a listview.

Is there a way to set StickyListHeaders to not show headers at all? There are options for making headers not sticky. I want the headers to just not show up, is that possible with the existing API?

    @Override
    public View getHeaderView(int position, View convertView, ViewGroup parent) {
        // do nothing
        return null;
    }

    @Override
    public long getHeaderId(int position) {
        // do nothing
        return 0;
    }
like image 439
lazypig Avatar asked Feb 15 '23 21:02

lazypig


1 Answers

Actually there's a lot simpler way

@Override
public View getHeaderView(int position, View convertView, ViewGroup parent) {
    return new View(parent.getContext());
}
like image 115
baneizalfe Avatar answered Apr 06 '23 15:04

baneizalfe