FileDocCategorySizeDatePackage
AdjacentVerticalRectLists.javaAPI DocAndroid 5.1 API3232Thu Mar 12 22:22:12 GMT 2015android.widget.focus

AdjacentVerticalRectLists

public class AdjacentVerticalRectLists extends android.app.Activity
{@link android.view.FocusFinder#findNextFocus(android.view.ViewGroup, android.view.View, int)} and {@link android.view.View#requestFocus(int, android.graphics.Rect)} work together to give a newly focused item a hint about the most interesting rectangle of the previously focused view. The view taking focus can use this to set an internal selection more appropriate using this rect. This Activity excercises that behavior using three adjacent {@link android.util.InternalSelectionView} that report interesting rects when giving up focus, and use interesting rects when taking focus to best select the internal row to show as selected.

Fields Summary
private android.widget.LinearLayout
mLayout
private android.util.InternalSelectionView
mLeftColumn
private android.util.InternalSelectionView
mMiddleColumn
private android.util.InternalSelectionView
mRightColumn
Constructors Summary
Methods Summary
public android.widget.LinearLayoutgetLayout()

        return mLayout;
    
public android.util.InternalSelectionViewgetLeftColumn()

        return mLeftColumn;
    
public android.util.InternalSelectionViewgetMiddleColumn()

        return mMiddleColumn;
    
public android.util.InternalSelectionViewgetRightColumn()

        return mRightColumn;
    
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        mLayout = new LinearLayout(this);
        mLayout.setOrientation(LinearLayout.HORIZONTAL);
        mLayout.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));

        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,
                ViewGroup.LayoutParams.MATCH_PARENT, 1);

        mLeftColumn = new InternalSelectionView(this, 5, "left column");
        mLeftColumn.setLayoutParams(params);
        mLeftColumn.setPadding(10, 10, 10, 10);
        mLayout.addView(mLeftColumn);

        mMiddleColumn = new InternalSelectionView(this, 5, "middle column");
        mMiddleColumn.setLayoutParams(params);
        mMiddleColumn.setPadding(10, 10, 10, 10);
        mLayout.addView(mMiddleColumn);

        mRightColumn = new InternalSelectionView(this, 5, "right column");
        mRightColumn.setLayoutParams(params);
        mRightColumn.setPadding(10, 10, 10, 10);
        mLayout.addView(mRightColumn);

        setContentView(mLayout);