@Test public void testMakeViewGone() throws Throwable { setContentView(R.layout.make_view_gone_test); int left = mLeftView.getWidth(); int right = mRightView.getWidth(); int total = mGridView.getWidth(); assertTrue("left item should get some width", left > 0); assertTrue("right item should get some width", right > 0); assertTrue("test sanity", total > 0); final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); mActivityTestRule.runOnUiThread(new Runnable() { @Override public void run() { final View rightView = mActivityTestRule.getActivity().findViewById(R.id.rightView); GridLayout.LayoutParams lp = (GridLayout.LayoutParams) rightView.getLayoutParams(); lp.setGravity(Gravity.NO_GRAVITY); rightView.setVisibility(View.GONE); } }); instrumentation.waitForIdleSync(); left = mActivityTestRule.getActivity().findViewById(R.id.leftView).getWidth(); assertEquals(total, left); }
final LayoutParams getLayoutParams(View c) { return (LayoutParams) c.getLayoutParams(); }
GridLayout extends ViewGroup { final LayoutParams getLayoutParams(View c) { return (LayoutParams) c.getLayoutParams(); } }
GridLayout extends ViewGroup { final LayoutParams getLayoutParams(View c) { return (LayoutParams) c.getLayoutParams(); } GridLayout(Context context, AttributeSet attrs, int defStyle);  GridLayout(Context context, AttributeSet attrs);  GridLayout(Context context); }
GridLayout extends ViewGroup { final LayoutParams getLayoutParams(View c) { return (LayoutParams) c.getLayoutParams(); } 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 { final LayoutParams getLayoutParams(View c) { return (LayoutParams) c.getLayoutParams(); } 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; }