@Override
    protected void constrainChild(View child, int width, int wMode, int height, int hMode) {

      super.constrainChild(child, width, wMode, height, hMode);

      // We need to support an automatically growing contentArea, so this code is
      // updates the measured dimensions as needed. absWidth, absHeight are
      // left in for debugging purposes. ATM

      int absWidth = calculateAbsoluteRight(child);
      int absHeight = calculateAbsoluteBottom(child);
    }
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int w = Math.max(MeasureSpec.getSize(widthMeasureSpec), getSuggestedMinimumWidth());
    int wMode = MeasureSpec.getMode(widthMeasureSpec);
    int h = Math.max(MeasureSpec.getSize(heightMeasureSpec), getSuggestedMinimumHeight());
    int hMode = MeasureSpec.getMode(heightMeasureSpec);

    int maxWidth = 0;
    int maxHeight = 0;

    for (int i = 0; i < getChildCount(); i++) {
      View child = getChildAt(i);
      if (child.getVisibility() != View.GONE) {
        constrainChild(child, w, wMode, h, hMode);
      }

      int childWidth = child.getMeasuredWidth();
      int childHeight = child.getMeasuredHeight();
      if (child.getVisibility() != View.GONE) {
        childWidth += getViewWidthPadding(child);
        childHeight += getViewHeightPadding(child);
      }

      maxWidth = Math.max(maxWidth, childWidth);
      if (vertical) {
        LayoutParams p = (LayoutParams) child.getLayoutParams();
        maxHeight += childHeight;
        if (p.optionTop != NOT_SET) {
          maxHeight += p.optionTop;
        }
      } else {
        maxHeight = Math.max(maxHeight, childHeight);
      }
    }

    // account for padding
    maxWidth += getPaddingLeft() + getPaddingRight();
    maxHeight += getPaddingTop() + getPaddingBottom();

    // Account for border
    // int padding = Math.round(borderHelper.calculatePadding());
    // maxWidth += padding;
    // maxHeight += padding;

    // check minimums
    maxWidth = Math.max(maxWidth, getSuggestedMinimumWidth());
    maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight());

    int measuredWidth = getMeasuredWidth(maxWidth, widthMeasureSpec);
    int measuredHeight = getMeasuredHeight(maxHeight, heightMeasureSpec);
    setMeasuredDimension(measuredWidth, measuredHeight);
  }