FileDocCategorySizeDatePackage
ListHeterogeneous.javaAPI DocAndroid 1.5 API2593Wed May 06 22:42:02 BST 2009com.android.frameworktest.listview

ListHeterogeneous

public class ListHeterogeneous extends com.android.frameworktest.util.ListScenario
List that has different view types

Fields Summary
Constructors Summary
Methods Summary
public android.view.ViewconvertView(int position, android.view.View convertView, android.view.ViewGroup parent)

        switch (position % 3) {
        case 0:
            return ListItemFactory.convertText(convertView, getValueAtPosition(position), position);
        case 1:
            return ListItemFactory.convertButton(convertView, getValueAtPosition(position),
                    position);
        case 2:
            return ListItemFactory.convertDoubleText(convertView, getValueAtPosition(position),
                    position);
        }

        return null;
    
protected android.view.ViewcreateView(int position, android.view.ViewGroup parent, int desiredHeight)

        switch (position % 3) {
        case 0:
            return ListItemFactory.text(
                    position, parent.getContext(), getValueAtPosition(position), desiredHeight);
        case 1:
            return ListItemFactory.button(
                    position, parent.getContext(), getValueAtPosition(position), desiredHeight);
        case 2:
            return ListItemFactory.doubleText(
                    position, parent.getContext(), getValueAtPosition(position), desiredHeight);
        }
        
        return null;
    
public intgetItemViewType(int position)

        return position % 3;
    
public intgetViewTypeCount()

        return 3;
    
protected voidinit(Params params)

        params.setNumItems(50)
                .setItemScreenSizeFactor(1.0 / 8)
                .setItemsFocusable(true)
                .setHeaderViewCount(3)
                .setFooterViewCount(2);