add List Header View - Android User Interface

Android examples for User Interface:ListView

Description

add List Header View

Demo Code


//package com.java2s;

import android.view.View;

import android.widget.ListView;

public class Main {
    public static void addListHeaderView(ListView listView, View header) {
        // should make sure ListView with null adapter before adding header view.
        if (listView.getAdapter() != null) {
            System.err//  w w w  .ja v  a 2 s  .  c o  m
                    .println("Should call setAdapter(null) before adding header view.");
        }
        listView.addHeaderView(header);
    }
}

Related Tutorials