FileDocCategorySizeDatePackage
AdjacentVerticalRectLists.javaAPI DocAndroid 1.5 API3276Wed May 06 22:42:02 BST 2009com.android.frameworktest.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 com.android.frameworktest.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 com.android.frameworktest.util.InternalSelectionView
mLeftColumn
private com.android.frameworktest.util.InternalSelectionView
mMiddleColumn
private com.android.frameworktest.util.InternalSelectionView
mRightColumn
Constructors Summary
Methods Summary
public android.widget.LinearLayoutgetLayout()

        return mLayout;
    
public com.android.frameworktest.util.InternalSelectionViewgetLeftColumn()

        return mLeftColumn;
    
public com.android.frameworktest.util.InternalSelectionViewgetMiddleColumn()

        return mMiddleColumn;
    
public com.android.frameworktest.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.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,
                ViewGroup.LayoutParams.FILL_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);