FileDocCategorySizeDatePackage
VerticalGridView.javaAPI DocAndroid 5.1 API2854Thu Mar 12 22:22:56 GMT 2015android.support.v17.leanback.widget

VerticalGridView

public class VerticalGridView extends BaseGridView
A view that shows items in a vertically scrolling list. The items come from the {@link RecyclerView.Adapter} associated with this view.

Fields Summary
Constructors Summary
public VerticalGridView(android.content.Context context)

        this(context, null);
    
public VerticalGridView(android.content.Context context, android.util.AttributeSet attrs)

        this(context, attrs, 0);
    
public VerticalGridView(android.content.Context context, android.util.AttributeSet attrs, int defStyle)

        super(context, attrs, defStyle);
        mLayoutManager.setOrientation(RecyclerView.VERTICAL);
        initAttributes(context, attrs);
    
Methods Summary
protected voidinitAttributes(android.content.Context context, android.util.AttributeSet attrs)

        initBaseGridViewAttributes(context, attrs);
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.lbVerticalGridView);
        setColumnWidth(a);
        setNumColumns(a.getInt(R.styleable.lbVerticalGridView_numberOfColumns, 1));
        a.recycle();
    
voidsetColumnWidth(android.content.res.TypedArray array)

        TypedValue typedValue = array.peekValue(R.styleable.lbVerticalGridView_columnWidth);
        int size;
        if (typedValue != null && typedValue.type == TypedValue.TYPE_DIMENSION) {
            size = array.getDimensionPixelSize(R.styleable.lbVerticalGridView_columnWidth, 0);
        } else {
            size = array.getInt(R.styleable.lbVerticalGridView_columnWidth, 0);
        }
        setColumnWidth(size);
    
public voidsetColumnWidth(int width)
Set the column width.

param
width May be WRAP_CONTENT, or a size in pixels. If zero, column width will be fixed based on number of columns and view width.

        mLayoutManager.setRowHeight(width);
        requestLayout();
    
public voidsetNumColumns(int numColumns)
Set the number of columns. Defaults to one.

        mLayoutManager.setNumRows(numColumns);
        requestLayout();