FileDocCategorySizeDatePackage
ExpandableListWithHeaders.javaAPI DocAndroid 1.5 API2358Wed May 06 22:42:02 BST 2009com.android.frameworktest.expandablelistview

ExpandableListWithHeaders

public class ExpandableListWithHeaders extends com.android.frameworktest.util.ExpandableListScenario

Fields Summary
private static final int[]
sNumChildren
private static final int
sNumOfHeadersAndFooters
Constructors Summary
Methods Summary
public intgetNumOfHeadersAndFooters()

return
The number of headers (and the same number of footers)

        return sNumOfHeadersAndFooters;
    
protected voidinit(ExpandableParams params)

    
    
        
        params.setStackFromBottom(false)
                .setStartingSelectionPosition(-1)
                .setNumChildren(sNumChildren)
                .setItemScreenSizeFactor(0.14)
                .setConnectAdapter(false);
    
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        final ExpandableListView expandableListView = getExpandableListView();
        expandableListView.setItemsCanFocus(true);

        for (int i = 0; i < sNumOfHeadersAndFooters; i++) {
            Button header = new Button(this);
            header.setText("Header View");
            expandableListView.addHeaderView(header);
        }

        for (int i = 0; i < sNumOfHeadersAndFooters; i++) {
            Button footer = new Button(this);
            footer.setText("Footer View");
            expandableListView.addFooterView(footer);
        }
        
        // Set adapter here AFTER we set header and footer views
        setAdapter(expandableListView);