Java Code Examples for android.view.View.MeasureSpec#getMode()

The following examples show how to use android.view.View.MeasureSpec#getMode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: X8TabHost.java    From FimiX8-RE with MIT License 7 votes vote down vote up
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int i;
    int modeWidth = MeasureSpec.getMode(widthMeasureSpec);
    int modeHeight = MeasureSpec.getMode(heightMeasureSpec);
    int sizeWidth = MeasureSpec.getSize(widthMeasureSpec);
    int sizeHeight = MeasureSpec.getSize(heightMeasureSpec);
    if (modeWidth != NTLMConstants.FLAG_NEGOTIATE_KEY_EXCHANGE && this.tabWidth > -1) {
        for (i = 0; i < getChildCount(); i++) {
            ((LayoutParams) ((TextView) getChildAt(i)).getLayoutParams()).width = this.tabWidth;
        }
    }
    if (modeHeight != NTLMConstants.FLAG_NEGOTIATE_KEY_EXCHANGE && this.tabHeight > -1) {
        for (i = 0; i < getChildCount(); i++) {
            ((LayoutParams) ((TextView) getChildAt(i)).getLayoutParams()).height = this.tabHeight;
        }
    }
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
 
Example 2
Source File: MediaDownloadProgressView.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
    int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec);
    int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
    int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec);
    if (widthSpecMode == NTLMConstants.FLAG_NEGOTIATE_KEY_EXCHANGE || widthSpecMode == Integer.MIN_VALUE) {
        this.mWidth = widthSpecSize;
    } else {
        this.mWidth = 0;
    }
    if (heightSpecMode == Integer.MIN_VALUE || heightSpecMode == 0) {
        this.mHeight = dipToPx(15);
    } else {
        this.mHeight = heightSpecSize;
    }
    setMeasuredDimension(this.mWidth, this.mHeight);
}
 
Example 3
Source File: VideoViewH264m3u8.java    From letv with Apache License 2.0 6 votes vote down vote up
public int resolveAdjustedSize(int desiredSize, int measureSpec) {
    int result = desiredSize;
    int specMode = MeasureSpec.getMode(measureSpec);
    int specSize = MeasureSpec.getSize(measureSpec);
    switch (specMode) {
        case Integer.MIN_VALUE:
            result = Math.min(desiredSize, specSize);
            LogTag.i(TAG, "resolveAdjustedSize(AT_MOST),use " + result);
            return result;
        case 0:
            result = desiredSize;
            LogTag.i(TAG, "resolveAdjustedSize(UNSPECIFIED),use " + result);
            return result;
        case 1073741824:
            result = specSize;
            LogTag.i(TAG, "resolveAdjustedSize(EXACTLY),use " + result);
            return result;
        default:
            return result;
    }
}
 
Example 4
Source File: MidView.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    int wSpecMode = MeasureSpec.getMode(widthMeasureSpec);
    int wSpecSize = MeasureSpec.getSize(widthMeasureSpec);
    int hSpecMode = MeasureSpec.getMode(heightMeasureSpec);
    int hSpecSize = MeasureSpec.getSize(heightMeasureSpec);
    int resultWidth = wSpecSize;
    int resultHeight = hSpecSize;
    if (wSpecMode == Integer.MIN_VALUE && hSpecMode == Integer.MIN_VALUE) {
        resultWidth = this.birmapbg.getWidth();
        resultHeight = this.birmapbg.getHeight();
    } else if (wSpecMode == Integer.MIN_VALUE) {
        resultWidth = this.birmapbg.getWidth();
        resultHeight = hSpecSize;
    } else if (hSpecMode == Integer.MIN_VALUE) {
        resultWidth = wSpecSize;
        resultHeight = this.birmapbg.getHeight();
    }
    resultWidth = Math.min(resultWidth, wSpecSize);
    resultHeight = Math.min(resultHeight, hSpecSize);
    this.centerX = (float) (this.birmapbg.getWidth() / 2);
    this.centerY = (float) (this.birmapbg.getHeight() / 2);
    this.endX = this.centerX;
    this.endY = this.centerY;
    setMeasuredDimension(resultWidth, resultHeight);
}
 
Example 5
Source File: TabPageIndicator.java    From letv with Apache License 2.0 6 votes vote down vote up
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int widthMode = MeasureSpec.getMode(widthMeasureSpec);
    boolean lockedExpanded = widthMode == 1073741824;
    setFillViewport(lockedExpanded);
    int childCount = this.mTabLayout.getChildCount();
    if (childCount <= 1 || !(widthMode == 1073741824 || widthMode == Integer.MIN_VALUE)) {
        this.mMaxTabWidth = -1;
    } else if (childCount > 2) {
        this.mMaxTabWidth = (int) (((float) MeasureSpec.getSize(widthMeasureSpec)) * 0.4f);
    } else {
        this.mMaxTabWidth = MeasureSpec.getSize(widthMeasureSpec) / 2;
    }
    int oldWidth = getMeasuredWidth();
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    int newWidth = getMeasuredWidth();
    if (lockedExpanded && oldWidth != newWidth) {
        setCurrentItem(this.mSelectedTabIndex);
    }
}
 
Example 6
Source File: VideoViewH264LeMobile.java    From letv with Apache License 2.0 5 votes vote down vote up
public int resolveAdjustedSize(int desiredSize, int measureSpec) {
    int result = desiredSize;
    int specMode = MeasureSpec.getMode(measureSpec);
    int specSize = MeasureSpec.getSize(measureSpec);
    switch (specMode) {
        case Integer.MIN_VALUE:
            return Math.min(desiredSize, specSize);
        case 0:
            return desiredSize;
        case 1073741824:
            return specSize;
        default:
            return result;
    }
}
 
Example 7
Source File: UIImplementation.java    From react-native-GPay with MIT License 5 votes vote down vote up
/**
 * Updates the styles of the {@link ReactShadowNode} based on the Measure specs received by
 * parameters.
 */
public void updateRootView(
    ReactShadowNode rootCSSNode, int widthMeasureSpec, int heightMeasureSpec) {
  int widthMode = MeasureSpec.getMode(widthMeasureSpec);
  int widthSize = MeasureSpec.getSize(widthMeasureSpec);
  switch (widthMode) {
    case EXACTLY:
      rootCSSNode.setStyleWidth(widthSize);
      break;
    case AT_MOST:
      rootCSSNode.setStyleMaxWidth(widthSize);
      break;
    case UNSPECIFIED:
      rootCSSNode.setStyleWidthAuto();
      break;
  }

  int heightMode = MeasureSpec.getMode(heightMeasureSpec);
  int heightSize = MeasureSpec.getSize(heightMeasureSpec);
  switch (heightMode) {
    case EXACTLY:
      rootCSSNode.setStyleHeight(heightSize);
      break;
    case AT_MOST:
      rootCSSNode.setStyleMaxHeight(heightSize);
      break;
    case UNSPECIFIED:
      rootCSSNode.setStyleHeightAuto();
      break;
  }
}
 
Example 8
Source File: BaseResolutionPolicy.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
protected static void throwOnNotMeasureSpecEXACTLY(final int pWidthMeasureSpec, final int pHeightMeasureSpec) {
	final int specWidthMode = MeasureSpec.getMode(pWidthMeasureSpec);
	final int specHeightMode = MeasureSpec.getMode(pHeightMeasureSpec);

	if (specWidthMode != MeasureSpec.EXACTLY || specHeightMode != MeasureSpec.EXACTLY) {
		throw new IllegalStateException("This IResolutionPolicy requires MeasureSpec.EXACTLY ! That means ");
	}
}
 
Example 9
Source File: PieView.java    From quickmark with MIT License 5 votes vote down vote up
private int measureHeight(int pHeightMeasureSpec) {
	int result = 0;

	int heightMode = MeasureSpec.getMode(pHeightMeasureSpec);
	int heightSize = MeasureSpec.getSize(pHeightMeasureSpec);

	switch (heightMode) {
	case MeasureSpec.AT_MOST:
	case MeasureSpec.EXACTLY:
		result = heightSize;
		break;
	}
	return result;
}
 
Example 10
Source File: X8MapPointMarkerViewGroup.java    From FimiX8-RE with MIT License 5 votes vote down vote up
private int measureWidth(int measureSpec, int width) {
    int mode = MeasureSpec.getMode(measureSpec);
    int size = MeasureSpec.getSize(measureSpec);
    if (mode == NTLMConstants.FLAG_NEGOTIATE_KEY_EXCHANGE) {
        return size;
    }
    int result = width;
    if (mode == Integer.MIN_VALUE) {
        return Math.min(result, size);
    }
    return result;
}
 
Example 11
Source File: X8MapPointMarkerViewGroup.java    From FimiX8-RE with MIT License 5 votes vote down vote up
private int measureHeight(int measureSpec, int height) {
    int mode = MeasureSpec.getMode(measureSpec);
    int size = MeasureSpec.getSize(measureSpec);
    if (mode == NTLMConstants.FLAG_NEGOTIATE_KEY_EXCHANGE) {
        return size;
    }
    int result = height;
    if (mode == Integer.MIN_VALUE) {
        return Math.min(result, size);
    }
    return result;
}
 
Example 12
Source File: VideoViewH264mp4.java    From letv with Apache License 2.0 5 votes vote down vote up
public int resolveAdjustedSize(int desiredSize, int measureSpec) {
    int result = desiredSize;
    int specMode = MeasureSpec.getMode(measureSpec);
    int specSize = MeasureSpec.getSize(measureSpec);
    switch (specMode) {
        case Integer.MIN_VALUE:
            return Math.min(desiredSize, specSize);
        case 0:
            return desiredSize;
        case 1073741824:
            return specSize;
        default:
            return result;
    }
}
 
Example 13
Source File: VideoViewH264LeMobile_4D.java    From letv with Apache License 2.0 5 votes vote down vote up
public int resolveAdjustedSize(int desiredSize, int measureSpec) {
    int result = desiredSize;
    int specMode = MeasureSpec.getMode(measureSpec);
    int specSize = MeasureSpec.getSize(measureSpec);
    switch (specMode) {
        case Integer.MIN_VALUE:
            return Math.min(desiredSize, specSize);
        case 0:
            return desiredSize;
        case 1073741824:
            return specSize;
        default:
            return result;
    }
}
 
Example 14
Source File: DragSortItemView.java    From chromadoze with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 
 */
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

    int height = MeasureSpec.getSize(heightMeasureSpec);
    int width = MeasureSpec.getSize(widthMeasureSpec);

    int heightMode = MeasureSpec.getMode(heightMeasureSpec);

    final View child = getChildAt(0);
    if (child == null) {
        setMeasuredDimension(0, width);
        return;
    }

    if (child.isLayoutRequested()) {
        // Always let child be as tall as it wants.
        measureChild(child, widthMeasureSpec,
                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
    }

    if (heightMode == MeasureSpec.UNSPECIFIED) {
        ViewGroup.LayoutParams lp = getLayoutParams();

        if (lp.height > 0) {
            height = lp.height;
        } else {
            height = child.getMeasuredHeight();
        }
    }

    setMeasuredDimension(width, height);
}
 
Example 15
Source File: PiewController.java    From quickmark with MIT License 5 votes vote down vote up
public static int measureHeight(int pHeightMeasureSpec) {
	int result = 0;

	int heightMode = MeasureSpec.getMode(pHeightMeasureSpec);
	int heightSize = MeasureSpec.getSize(pHeightMeasureSpec);

	switch (heightMode) {
	case MeasureSpec.AT_MOST:
	case MeasureSpec.EXACTLY:
		result = heightSize;
		break;
	}
	return result;
}
 
Example 16
Source File: LabelsView.java    From FimiX8-RE with MIT License 5 votes vote down vote up
private int measureWidth(int measureSpec, int contentWidth) {
    int result;
    int specMode = MeasureSpec.getMode(measureSpec);
    int specSize = MeasureSpec.getSize(measureSpec);
    if (specMode == NTLMConstants.FLAG_NEGOTIATE_KEY_EXCHANGE) {
        result = specSize;
    } else {
        result = (getPaddingLeft() + contentWidth) + getPaddingRight();
        if (specMode == Integer.MIN_VALUE) {
            result = Math.min(result, specSize);
        }
    }
    return Math.max(result, getSuggestedMinimumWidth());
}
 
Example 17
Source File: GridLayout.java    From tns-core-modules-widgets with Apache License 2.0 4 votes vote down vote up
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    CommonLayoutParams.adjustChildrenLayoutParams(this, widthMeasureSpec, heightMeasureSpec);

    int measureWidth = 0;
    int measureHeight = 0;

    int width = MeasureSpec.getSize(widthMeasureSpec);
    int widthMode = MeasureSpec.getMode(widthMeasureSpec);

    int height = MeasureSpec.getSize(heightMeasureSpec);
    int heightMode = MeasureSpec.getMode(heightMeasureSpec);

    int verticalPadding = this.getPaddingTop() + this.getPaddingBottom();
    int horizontalPadding = this.getPaddingLeft() + this.getPaddingRight();

    boolean infinityWidth = widthMode == MeasureSpec.UNSPECIFIED;
    boolean infinityHeight = heightMode == MeasureSpec.UNSPECIFIED;

    this.helper.width = Math.max(0, width - horizontalPadding);
    this.helper.height = Math.max(0, height - verticalPadding);

    int gravity = LayoutBase.getGravity(this);
    int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
    final int layoutDirection = this.getLayoutDirection();
    final int horizontalGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection) & Gravity.HORIZONTAL_GRAVITY_MASK;

    this.helper.stretchedHorizontally = widthMode == MeasureSpec.EXACTLY || (horizontalGravity == Gravity.FILL_HORIZONTAL && !infinityWidth);
    this.helper.stretchedVertically = heightMode == MeasureSpec.EXACTLY || (verticalGravity == Gravity.FILL_VERTICAL && !infinityHeight);

    this.helper.setInfinityWidth(infinityWidth);
    this.helper.setInfinityHeight(infinityHeight);

    this.helper.clearMeasureSpecs();
    this.helper.init();

    for (int i = 0, count = this.getChildCount(); i < count; i++) {
        View child = this.getChildAt(i);
        if (child.getVisibility() == View.GONE) {
            continue;
        }

        MeasureSpecs measureSpecs = this.map.get(child);
        this.updateMeasureSpecs(child, measureSpecs);
        this.helper.addMeasureSpec(measureSpecs);
    }

    this.helper.measure();

    // Add in our padding
    measureWidth = this.helper.measuredWidth + horizontalPadding;
    measureHeight = this.helper.measuredHeight + verticalPadding;

    // Check against our minimum sizes
    measureWidth = Math.max(measureWidth, this.getSuggestedMinimumWidth());
    measureHeight = Math.max(measureHeight, this.getSuggestedMinimumHeight());

    int widthSizeAndState = resolveSizeAndState(measureWidth, widthMeasureSpec, 0);
    int heightSizeAndState = resolveSizeAndState(measureHeight, heightMeasureSpec, 0);

    this.setMeasuredDimension(widthSizeAndState, heightSizeAndState);
}
 
Example 18
Source File: CircleMenuLayout.java    From accountBook with Apache License 2.0 4 votes vote down vote up
/**
 * 设置布局的宽高,并策略menu item宽高
 */
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
    int resWidth = 0;
    int resHeight = 0;

    /**
     * 根据传入的参数,分别获取测量模式和测量值
     */
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int widthMode = MeasureSpec.getMode(widthMeasureSpec);

    int height = MeasureSpec.getSize(heightMeasureSpec);
    int heightMode = MeasureSpec.getMode(heightMeasureSpec);

    /**
     * 如果宽或者高的测量模式非精确值
     */
    if (widthMode != MeasureSpec.EXACTLY
            || heightMode != MeasureSpec.EXACTLY)
    {
        // 主要设置为背景图的高度
        resWidth = getSuggestedMinimumWidth();
        // 如果未设置背景图片,则设置为屏幕宽高的默认值
        resWidth = resWidth == 0 ? getDefaultWidth() : resWidth;

        resHeight = getSuggestedMinimumHeight();
        // 如果未设置背景图片,则设置为屏幕宽高的默认值
        resHeight = resHeight == 0 ? getDefaultWidth() : resHeight;
    } else
    {
        // 如果都设置为精确值,则直接取小值;
        resWidth = resHeight = Math.min(width, height);
    }

    setMeasuredDimension(resWidth, resHeight);

    // 获得半径
    mRadius = Math.max(getMeasuredWidth(), getMeasuredHeight());

    // menu item数量
    final int count = getChildCount();
    // menu item尺寸
    int childSize = (int) (mRadius * RADIO_DEFAULT_CHILD_DIMENSION);
    // menu item测量模式
    int childMode = MeasureSpec.EXACTLY;

    // 迭代测量
    for (int i = 0; i < count; i++)
    {
        final View child = getChildAt(i);

        if (child.getVisibility() == GONE)
        {
            continue;
        }

        // 计算menu item的尺寸;以及和设置好的模式,去对item进行测量
        int makeMeasureSpec = -1;

        if (child.getId() == R.id.id_circle_menu_item_center)
        {
            makeMeasureSpec = MeasureSpec.makeMeasureSpec(
                    (int) (mRadius * RADIO_DEFAULT_CENTERITEM_DIMENSION),
                    childMode);
        } else
        {
            makeMeasureSpec = MeasureSpec.makeMeasureSpec(childSize,
                    childMode);
        }
        child.measure(makeMeasureSpec, makeMeasureSpec);
    }

    mPadding = RADIO_PADDING_LAYOUT * mRadius;

}
 
Example 19
Source File: ViewFlow.java    From NewXmPluginSDK with Apache License 2.0 4 votes vote down vote up
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
	int widthSize = MeasureSpec.getSize(widthMeasureSpec);
	int heightSize = MeasureSpec.getSize(heightMeasureSpec);
	final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
	final int heightMode = MeasureSpec.getMode(heightMeasureSpec);

	int childWidth = 0;
	int childHeight = 0;
	int childState = 0;

	final int widthPadding = getWidthPadding();
	final int heightPadding = getHeightPadding();

	int count = mAdapter == null ? 0 : mAdapter.getCount();
	if (count > 0) {
		final View child = obtainView(0);
		measureChild(child, widthMeasureSpec, heightMeasureSpec);
		childWidth = child.getMeasuredWidth();
		childHeight = child.getMeasuredHeight();
		if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.ICE_CREAM_SANDWICH)
		childState = child.getMeasuredState();
		mRecycledViews.add(child);
	}

	switch (widthMode) {
		case MeasureSpec.UNSPECIFIED:
			widthSize = childWidth + widthPadding;
			break;
		case MeasureSpec.AT_MOST:
			widthSize = (childWidth + widthPadding) | childState;
			break;
		case MeasureSpec.EXACTLY:
			if (widthSize < childWidth + widthPadding)
				widthSize |= MEASURED_STATE_TOO_SMALL;
			break;
	}
	switch (heightMode) {
		case MeasureSpec.UNSPECIFIED:
			heightSize = childHeight + heightPadding;
			break;
		case MeasureSpec.AT_MOST:
			heightSize = (childHeight + heightPadding) | (childState >> MEASURED_HEIGHT_STATE_SHIFT);
			break;
		case MeasureSpec.EXACTLY:
			if (heightSize < childHeight + heightPadding)
				heightSize |= MEASURED_STATE_TOO_SMALL;
			break;
	}

	if (heightMode == MeasureSpec.UNSPECIFIED) {
		heightSize = heightPadding + childHeight;
	} else {
		heightSize |= (childState&MEASURED_STATE_MASK);
	}

	setMeasuredDimension(widthSize, heightSize);
}
 
Example 20
Source File: DrawerLayout.java    From letv with Apache License 2.0 4 votes vote down vote up
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int widthMode = MeasureSpec.getMode(widthMeasureSpec);
    int heightMode = MeasureSpec.getMode(heightMeasureSpec);
    int widthSize = MeasureSpec.getSize(widthMeasureSpec);
    int heightSize = MeasureSpec.getSize(heightMeasureSpec);
    if (!(widthMode == 1073741824 && heightMode == 1073741824)) {
        if (isInEditMode()) {
            if (widthMode != Integer.MIN_VALUE) {
                if (widthMode == 0) {
                    widthSize = 300;
                }
            }
            if (heightMode != Integer.MIN_VALUE) {
                if (heightMode == 0) {
                    heightSize = 300;
                }
            }
        } else {
            throw new IllegalArgumentException("DrawerLayout must be measured with MeasureSpec.EXACTLY.");
        }
    }
    setMeasuredDimension(widthSize, heightSize);
    boolean applyInsets = this.mLastInsets != null && ViewCompat.getFitsSystemWindows(this);
    int layoutDirection = ViewCompat.getLayoutDirection(this);
    boolean hasDrawerOnLeftEdge = false;
    boolean hasDrawerOnRightEdge = false;
    int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);
        if (child.getVisibility() != 8) {
            MarginLayoutParams lp = (LayoutParams) child.getLayoutParams();
            if (applyInsets) {
                int cgrav = GravityCompat.getAbsoluteGravity(lp.gravity, layoutDirection);
                if (ViewCompat.getFitsSystemWindows(child)) {
                    IMPL.dispatchChildInsets(child, this.mLastInsets, cgrav);
                } else {
                    IMPL.applyMarginInsets(lp, this.mLastInsets, cgrav);
                }
            }
            if (isContentView(child)) {
                child.measure(MeasureSpec.makeMeasureSpec((widthSize - lp.leftMargin) - lp.rightMargin, 1073741824), MeasureSpec.makeMeasureSpec((heightSize - lp.topMargin) - lp.bottomMargin, 1073741824));
            } else if (isDrawerView(child)) {
                if (SET_DRAWER_SHADOW_FROM_ELEVATION && ViewCompat.getElevation(child) != this.mDrawerElevation) {
                    ViewCompat.setElevation(child, this.mDrawerElevation);
                }
                int childGravity = getDrawerViewAbsoluteGravity(child) & 7;
                boolean isLeftEdgeDrawer = childGravity == 3;
                if (!(isLeftEdgeDrawer && hasDrawerOnLeftEdge) && (isLeftEdgeDrawer || !hasDrawerOnRightEdge)) {
                    if (isLeftEdgeDrawer) {
                        hasDrawerOnLeftEdge = true;
                    } else {
                        hasDrawerOnRightEdge = true;
                    }
                    child.measure(getChildMeasureSpec(widthMeasureSpec, (this.mMinDrawerMargin + lp.leftMargin) + lp.rightMargin, lp.width), getChildMeasureSpec(heightMeasureSpec, lp.topMargin + lp.bottomMargin, lp.height));
                } else {
                    throw new IllegalStateException("Child drawer has absolute gravity " + gravityToString(childGravity) + " but this " + TAG + " already has a " + "drawer view along that edge");
                }
            } else {
                throw new IllegalStateException("Child " + child + " at index " + i + " does not have a valid layout_gravity - must be Gravity.LEFT, " + "Gravity.RIGHT or Gravity.NO_GRAVITY");
            }
        }
    }
}