FileDocCategorySizeDatePackage
Space.javaAPI DocAndroid 5.1 API2867Thu Mar 12 22:22:10 GMT 2015android.widget

Space

public final class Space extends android.view.View
Space is a lightweight View subclass that may be used to create gaps between components in general purpose layouts.

Fields Summary
Constructors Summary
public Space(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
{@inheritDoc}

        super(context, attrs, defStyleAttr, defStyleRes);
        if (getVisibility() == VISIBLE) {
            setVisibility(INVISIBLE);
        }
    
public Space(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
{@inheritDoc}

        this(context, attrs, defStyleAttr, 0);
    
public Space(android.content.Context context, android.util.AttributeSet attrs)
{@inheritDoc}

        this(context, attrs, 0);
    
public Space(android.content.Context context)
{@inheritDoc}

        //noinspection NullableProblems
        this(context, null);
    
Methods Summary
public voiddraw(android.graphics.Canvas canvas)
Draw nothing.

param
canvas an unused parameter.

    
private static intgetDefaultSize2(int size, int measureSpec)
Compare to: {@link View#getDefaultSize(int, int)} If mode is AT_MOST, return the child size instead of the parent size (unless it is too big).

        int result = size;
        int specMode = MeasureSpec.getMode(measureSpec);
        int specSize = MeasureSpec.getSize(measureSpec);

        switch (specMode) {
            case MeasureSpec.UNSPECIFIED:
                result = size;
                break;
            case MeasureSpec.AT_MOST:
                result = Math.min(size, specSize);
                break;
            case MeasureSpec.EXACTLY:
                result = specSize;
                break;
        }
        return result;
    
protected voidonMeasure(int widthMeasureSpec, int heightMeasureSpec)

        setMeasuredDimension(
                getDefaultSize2(getSuggestedMinimumWidth(), widthMeasureSpec),
                getDefaultSize2(getSuggestedMinimumHeight(), heightMeasureSpec));