@Test public void testGenerateLayoutParamsFromMarginParams() { MyGridLayout gridLayout = new MyGridLayout(mActivityTestRule.getActivity()); ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(3, 5); lp.leftMargin = 1; lp.topMargin = 2; lp.rightMargin = 3; lp.bottomMargin = 4; GridLayout.LayoutParams generated = gridLayout.generateLayoutParams(lp); assertEquals(3, generated.width); assertEquals(5, generated.height); assertEquals(1, generated.leftMargin); assertEquals(2, generated.topMargin); assertEquals(3, generated.rightMargin); assertEquals(4, generated.bottomMargin); }
@Override public LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(getContext(), attrs); }
GridLayout extends ViewGroup { @Override public LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(getContext(), attrs); } }
GridLayout extends ViewGroup { @Override public LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(getContext(), attrs); } GridLayout(Context context, AttributeSet attrs, int defStyle);  GridLayout(Context context, AttributeSet attrs);  GridLayout(Context context); }
GridLayout extends ViewGroup { @Override public LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(getContext(), attrs); } GridLayout(Context context, AttributeSet attrs, int defStyle);  GridLayout(Context context, AttributeSet attrs);  GridLayout(Context context); int getOrientation(); void setOrientation(int orientation); int getRowCount(); void setRowCount(int rowCount); int getColumnCount(); void setColumnCount(int columnCount); boolean getUseDefaultMargins(); void setUseDefaultMargins(boolean useDefaultMargins); int getAlignmentMode(); void setAlignmentMode(int alignmentMode); boolean isRowOrderPreserved(); void setRowOrderPreserved(boolean rowOrderPreserved); boolean isColumnOrderPreserved(); void setColumnOrderPreserved(boolean columnOrderPreserved); Printer getPrinter(); void setPrinter(Printer printer); @Override LayoutParams generateLayoutParams(AttributeSet attrs); @Override void requestLayout(); static Spec spec(int start, int size, Alignment alignment, float weight); static Spec spec(int start, Alignment alignment, float weight); static Spec spec(int start, int size, float weight); static Spec spec(int start, float weight); static Spec spec(int start, int size, Alignment alignment); static Spec spec(int start, Alignment alignment); static Spec spec(int start, int size); static Spec spec(int start); }
GridLayout extends ViewGroup { @Override public LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(getContext(), attrs); } GridLayout(Context context, AttributeSet attrs, int defStyle);  GridLayout(Context context, AttributeSet attrs);  GridLayout(Context context); int getOrientation(); void setOrientation(int orientation); int getRowCount(); void setRowCount(int rowCount); int getColumnCount(); void setColumnCount(int columnCount); boolean getUseDefaultMargins(); void setUseDefaultMargins(boolean useDefaultMargins); int getAlignmentMode(); void setAlignmentMode(int alignmentMode); boolean isRowOrderPreserved(); void setRowOrderPreserved(boolean rowOrderPreserved); boolean isColumnOrderPreserved(); void setColumnOrderPreserved(boolean columnOrderPreserved); Printer getPrinter(); void setPrinter(Printer printer); @Override LayoutParams generateLayoutParams(AttributeSet attrs); @Override void requestLayout(); static Spec spec(int start, int size, Alignment alignment, float weight); static Spec spec(int start, Alignment alignment, float weight); static Spec spec(int start, int size, float weight); static Spec spec(int start, float weight); static Spec spec(int start, int size, Alignment alignment); static Spec spec(int start, Alignment alignment); static Spec spec(int start, int size); static Spec spec(int start); static final int HORIZONTAL; static final int VERTICAL; static final int UNDEFINED; static final int ALIGN_BOUNDS; static final int ALIGN_MARGINS; static final Alignment TOP; static final Alignment BOTTOM; static final Alignment START; static final Alignment END; static final Alignment LEFT; static final Alignment RIGHT; static final Alignment CENTER; static final Alignment BASELINE; static final Alignment FILL; }