FileDocCategorySizeDatePackage
ListHeterogeneous.javaAPI DocAndroid 5.1 API2546Thu Mar 12 22:22:12 GMT 2015android.widget.listview

ListHeterogeneous

public class ListHeterogeneous extends android.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);