Example usage for android.view View layout

List of usage examples for android.view View layout

Introduction

In this page you can find the example usage for android.view View layout.

Prototype

@SuppressWarnings({ "unchecked" })
public void layout(int l, int t, int r, int b) 

Source Link

Document

Assign a size and position to a view and all of its descendants

This is the second phase of the layout mechanism.

Usage

From source file:com.android.leanlauncher.CellLayout.java

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    int offset = getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - (mCountX * mCellWidth);
    int left = getPaddingLeft() + (int) Math.ceil(offset / 2f);
    int top = getPaddingTop();
    int count = getChildCount();
    for (int i = 0; i < count; i++) {
        View child = getChildAt(i);
        child.layout(left, top, left + r - l, top + b - t);
    }/*  www  .ja v  a 2  s.c  o m*/
}

From source file:org.telegram.ui.Components.ChatAttachAlert.java

@Override
protected boolean onCustomLayout(View view, int left, int top, int right, int bottom) {
    int width = (right - left);
    int height = (bottom - top);
    boolean isPortrait = width < height;
    if (view == cameraPanel) {
        if (isPortrait) {
            cameraPanel.layout(0, bottom - AndroidUtilities.dp(100), width, bottom);
        } else {/*  w w  w . j  a  v  a2 s.  c o  m*/
            cameraPanel.layout(right - AndroidUtilities.dp(100), 0, right, height);
        }
        return true;
    } else if (view == flashModeButton[0] || view == flashModeButton[1]) {
        int topAdd = Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.dp(10) : 0;
        int leftAdd = Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.dp(8) : 0;
        if (isPortrait) {
            view.layout(right - view.getMeasuredWidth() - leftAdd, topAdd, right - leftAdd,
                    topAdd + view.getMeasuredHeight());
        } else {
            view.layout(leftAdd, topAdd, leftAdd + view.getMeasuredWidth(), topAdd + view.getMeasuredHeight());
        }
        return true;
    }
    return false;
}

From source file:com.zyk.drawerlayout.widget.DrawerLayout.java

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    mInLayout = true;// ww w. ja v a2 s. c  om
    final int width = r - l;
    final int height = b - 1;
    final int wi = width / 4;
    final int he = height / 4;
    mLeftHeader = Math.min(mLeftHeader, wi);
    mTopHeader = Math.min(mTopHeader, he);
    mRightHeader = Math.min(mRightHeader, wi);
    mBottomHeader = Math.min(mBottomHeader, he);
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);

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

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        if (isContentView(child)) {
            child.layout(lp.leftMargin, lp.topMargin, lp.leftMargin + child.getMeasuredWidth(),
                    lp.topMargin + child.getMeasuredHeight());
        } else { // Drawer, if it wasn't onMeasure would have thrown an exception.
            final int childWidth = child.getMeasuredWidth();
            final int childHeight = child.getMeasuredHeight();
            int childLeft = 0;
            int childTop = 0;

            final float newOffset;
            if (checkDrawerViewAbsoluteGravity(child, Gravity.LEFT)) {
                childTop = lp.topMargin;
                if (mLeftHeader - childWidth >= child.getLeft()) {
                    childLeft = mLeftHeader - childWidth;
                    newOffset = 0;
                } else {
                    childLeft = -childWidth + (int) (childWidth * lp.onScreen);
                    newOffset = (float) (childWidth + childLeft) / childWidth;
                }
            } else if (checkDrawerViewAbsoluteGravity(child, Gravity.TOP)) {
                childLeft = lp.leftMargin;
                if (mTopHeader - childHeight >= child.getTop()) {
                    childTop = mTopHeader - childHeight;
                    newOffset = 0;
                } else {
                    childTop = -childHeight + (int) (childHeight * lp.onScreen);
                    newOffset = (float) (childTop + childHeight) / childHeight;
                }
            } else if (checkDrawerViewAbsoluteGravity(child, Gravity.RIGHT)) { // Right; onMeasure checked for us.
                childTop = lp.topMargin;
                if (width - mRightHeader >= child.getLeft()) {
                    childLeft = width - mRightHeader;
                    newOffset = 0;
                } else {
                    childLeft = width - (int) (childWidth * lp.onScreen);
                    newOffset = (float) (width - childLeft) / childWidth;
                }
            } else {
                childLeft = lp.leftMargin;
                if (height - mBottomHeader >= child.getTop()) {
                    childTop = height - mBottomHeader;
                    newOffset = 0;
                } else {
                    childTop = height - (int) (childHeight * lp.onScreen);
                    newOffset = (float) (height - childTop) / childHeight;
                }
            }

            final boolean changeOffset = newOffset != lp.onScreen;

            final int vgrav = lp.gravity & Gravity.VERTICAL_GRAVITY_MASK;
            //FIXME 
            if (vgrav == Gravity.CENTER_VERTICAL) {
                final int h = b - t;
                childTop = (h - childHeight) / 2;

                if (childTop < lp.topMargin) {
                    childTop = lp.topMargin;
                } else if (childTop + childHeight > h - lp.bottomMargin) {
                    childTop = h - lp.bottomMargin - childHeight;
                }
            }
            child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);

            if (changeOffset) {
                setDrawerViewOffset(child, newOffset);
            }

            //                final int newVisibility = lp.onScreen > 0 ? VISIBLE : INVISIBLE;
            //                if (child.getVisibility() != newVisibility) {
            //                    child.setVisibility(newVisibility);
            //                }
        }
    }
    mInLayout = false;
    mFirstLayout = false;
}

From source file:com.waz.zclient.pages.main.conversationpager.SlidingPaneLayout.java

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    final boolean isLayoutRtl = isLayoutRtlSupport();
    if (isLayoutRtl) {
        dragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    } else {/*w  ww .  j a  v  a2 s .  c  om*/
        dragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    }
    final int width = r - l;
    final int paddingStart = isLayoutRtl ? getPaddingRight() : getPaddingLeft();
    final int paddingEnd = isLayoutRtl ? getPaddingLeft() : getPaddingRight();
    final int paddingTop = getPaddingTop();

    final int childCount = getChildCount();
    int xStart = paddingStart;
    int nextXStart = xStart;

    if (firstLayout) {
        slideOffset = canSlide && preservedOpenState ? 1.f : 0.f;
    }

    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);

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

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        final int childWidth = child.getMeasuredWidth();
        int offset = 0;

        if (lp.slideable) {
            final int margin = lp.leftMargin + lp.rightMargin;
            final int range = Math.min(nextXStart, width - paddingEnd - overhangSize) - xStart - margin;
            slideRange = range;
            final int lpMargin = isLayoutRtl ? lp.rightMargin : lp.leftMargin;
            lp.dimWhenOffset = xStart + lpMargin + range + childWidth / 2 > width - paddingEnd;
            final int pos = (int) (range * slideOffset);
            xStart += pos + lpMargin;
            slideOffset = (float) pos / slideRange;
        } else if (canSlide && parallaxBy != 0) {
            offset = (int) ((1 - slideOffset) * parallaxBy);
            xStart = nextXStart;
        } else {
            xStart = nextXStart;
        }

        final int childRight;
        final int childLeft;
        if (isLayoutRtl) {
            childRight = width - xStart + offset;
            childLeft = childRight - childWidth;
        } else {
            childLeft = xStart - offset;
            childRight = childLeft + childWidth;
        }

        final int childTop = paddingTop;
        final int childBottom = childTop + child.getMeasuredHeight();
        child.layout(childLeft, paddingTop, childRight, childBottom);

        nextXStart += child.getWidth();
    }

    if (firstLayout) {
        if (canSlide) {
            if (parallaxBy != 0) {
                parallaxOtherViews(slideOffset);
            }
            if (((LayoutParams) slideableView.getLayoutParams()).dimWhenOffset) {
                dimChildView(slideableView, slideOffset, sliderFadeColor);
            }
        } else {
            // Reset the dim level of all children; it's irrelevant when nothing moves.
            for (int i = 0; i < childCount; i++) {
                dimChildView(getChildAt(i), 0, sliderFadeColor);
            }
        }
        updateObscuredViewsVisibility(slideableView);
    }

    firstLayout = false;
}

From source file:saphion.services.ForegroundService.java

/**
 * Functions For Graph//from w  ww  .jav  a 2 s . c o m
 */

public Bitmap loadBitmapFromView(View v) {
    Bitmap b = Bitmap.createBitmap(getResources().getDisplayMetrics().widthPixels,
            Functions.ReturnHeight(160, getBaseContext()), Config.ARGB_8888);
    Canvas c = new Canvas(b);
    v.layout(0, 0, getResources().getDisplayMetrics().widthPixels,
            Functions.ReturnHeight(160, getBaseContext()));
    v.draw(c);
    return b;
}

From source file:cn.zmdx.kaka.locker.widget.SlidingPaneLayout.java

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    final boolean isLayoutRtl = isLayoutRtlSupport();
    if (isLayoutRtl) {
        mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    } else {/*from w w w . ja  v  a 2  s . com*/
        mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    }
    final int width = r - l;
    final int paddingStart = isLayoutRtl ? getPaddingRight() : getPaddingLeft();
    final int paddingEnd = isLayoutRtl ? getPaddingLeft() : getPaddingRight();
    final int paddingTop = getPaddingTop();

    final int childCount = getChildCount();
    int xStart = paddingStart;
    int nextXStart = xStart;

    if (mFirstLayout) {
        mSlideOffset = mCanSlide && mPreservedOpenState ? 1.f : 0.f;
    }

    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);

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

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        final int childWidth = child.getMeasuredWidth();
        int offset = 0;

        if (lp.slideable) {
            final int margin = lp.leftMargin + lp.rightMargin;
            final int range = Math.min(nextXStart, width - paddingEnd - mOverhangSize) - xStart - margin;
            mSlideRange = range;
            final int lpMargin = isLayoutRtl ? lp.rightMargin : lp.leftMargin;
            lp.dimWhenOffset = xStart + lpMargin + range + childWidth / 2 > width - paddingEnd;
            final int pos = (int) (range * mSlideOffset);
            xStart += pos + lpMargin;
            mSlideOffset = (float) pos / mSlideRange;
        } else if (mCanSlide && mParallaxBy != 0) {
            offset = (int) ((1 - mSlideOffset) * mParallaxBy);
            xStart = nextXStart;
        } else {
            xStart = nextXStart;
        }

        final int childRight;
        final int childLeft;
        if (isLayoutRtl) {
            childRight = width - xStart + offset;
            childLeft = childRight - childWidth;
        } else {
            childLeft = xStart - offset;
            childRight = childLeft + childWidth;
        }

        final int childTop = paddingTop;
        final int childBottom = childTop + child.getMeasuredHeight();
        child.layout(childLeft, paddingTop, childRight, childBottom);

        nextXStart += child.getWidth();
    }

    if (mFirstLayout) {
        if (mCanSlide) {
            if (mParallaxBy != 0) {
                parallaxOtherViews(mSlideOffset);
            }
            if (((LayoutParams) mSlideableView.getLayoutParams()).dimWhenOffset) {
                dimChildView(mSlideableView, mSlideOffset, mSliderFadeColor);
            }
        } else {
            // Reset the dim level of all children; it's irrelevant when
            // nothing moves.
            for (int i = 0; i < childCount; i++) {
                dimChildView(getChildAt(i), 0, mSliderFadeColor);
            }
        }
        updateObscuredViewsVisibility(mSlideableView);
    }

    mFirstLayout = false;
}

From source file:com.google.android.flexbox.FlexboxLayout.java

/**
 * Place a single View when the layout direction is horizontal ({@link #mFlexDirection} is
 * either {@link #FLEX_DIRECTION_ROW} or {@link #FLEX_DIRECTION_ROW_REVERSE}).
 *
 * @param view       the View to be placed
 * @param flexLine   the {@link FlexLine} where the View belongs to
 * @param flexWrap   the flex wrap attribute of this FlexboxLayout
 * @param alignItems the align items attribute of this FlexboxLayout
 * @param left       the left position of the View, which the View's margin is already taken
 *                   into account//from w  w  w.java  2 s  .  c  o  m
 * @param top        the top position of the flex line where the View belongs to. The actual
 *                   View's top position is shifted depending on the flexWrap and alignItems
 *                   attributes
 * @param right      the right position of the View, which the View's margin is already taken
 *                   into account
 * @param bottom     the bottom position of the flex line where the View belongs to. The actual
 *                   View's bottom position is shifted depending on the flexWrap and alignItems
 *                   attributes
 * @see #getAlignItems()
 * @see #setAlignItems(int)
 * @see LayoutParams#alignSelf
 */
private void layoutSingleChildHorizontal(View view, FlexLine flexLine, @FlexWrap int flexWrap, int alignItems,
        int left, int top, int right, int bottom) {
    LayoutParams lp = (LayoutParams) view.getLayoutParams();
    if (lp.alignSelf != LayoutParams.ALIGN_SELF_AUTO) {
        // Expecting the values for alignItems and alignSelf match except for ALIGN_SELF_AUTO.
        // Assigning the alignSelf value as alignItems should work.
        alignItems = lp.alignSelf;
    }
    int crossSize = flexLine.mCrossSize;
    switch (alignItems) {
    case ALIGN_ITEMS_FLEX_START: // Intentional fall through
    case ALIGN_ITEMS_STRETCH:
        if (flexWrap != FLEX_WRAP_WRAP_REVERSE) {
            view.layout(left, top + lp.topMargin, right, bottom + lp.topMargin);
        } else {
            view.layout(left, top - lp.bottomMargin, right, bottom - lp.bottomMargin);
        }
        break;
    case ALIGN_ITEMS_BASELINE:
        if (flexWrap != FLEX_WRAP_WRAP_REVERSE) {
            int marginTop = flexLine.mMaxBaseline - view.getBaseline();
            marginTop = Math.max(marginTop, lp.topMargin);
            view.layout(left, top + marginTop, right, bottom + marginTop);
        } else {
            int marginBottom = flexLine.mMaxBaseline - view.getMeasuredHeight() + view.getBaseline();
            marginBottom = Math.max(marginBottom, lp.bottomMargin);
            view.layout(left, top - marginBottom, right, bottom - marginBottom);
        }
        break;
    case ALIGN_ITEMS_FLEX_END:
        if (flexWrap != FLEX_WRAP_WRAP_REVERSE) {
            view.layout(left, top + crossSize - view.getMeasuredHeight() - lp.bottomMargin, right,
                    top + crossSize - lp.bottomMargin);
        } else {
            // If the flexWrap == FLEX_WRAP_WRAP_REVERSE, the direction of the
            // flexEnd is flipped (from top to bottom).
            view.layout(left, top - crossSize + view.getMeasuredHeight() + lp.topMargin, right,
                    bottom - crossSize + view.getMeasuredHeight() + lp.topMargin);
        }
        break;
    case ALIGN_ITEMS_CENTER:
        int topFromCrossAxis = (crossSize - view.getMeasuredHeight()) / 2;
        if (flexWrap != FLEX_WRAP_WRAP_REVERSE) {
            view.layout(left, top + topFromCrossAxis + lp.topMargin - lp.bottomMargin, right,
                    top + topFromCrossAxis + view.getMeasuredHeight() + lp.topMargin - lp.bottomMargin);
        } else {
            view.layout(left, top - topFromCrossAxis + lp.topMargin - lp.bottomMargin, right,
                    top - topFromCrossAxis + view.getMeasuredHeight() + lp.topMargin - lp.bottomMargin);
        }
        break;
    }
}

From source file:com.google.android.flexbox.FlexboxLayout.java

/**
 * Place a single View when the layout direction is vertical ({@link #mFlexDirection} is
 * either {@link #FLEX_DIRECTION_COLUMN} or {@link #FLEX_DIRECTION_COLUMN_REVERSE}).
 *
 * @param view       the View to be placed
 * @param flexLine   the {@link FlexLine} where the View belongs to
 * @param isRtl      {@code true} if the layout direction is right to left, {@code false}
 *                   otherwise/*w  ww .  j  av  a  2  s .c  om*/
 * @param alignItems the align items attribute of this FlexboxLayout
 * @param left       the left position of the flex line where the View belongs to. The actual
 *                   View's left position is shifted depending on the isRtl and alignItems
 *                   attributes
 * @param top        the top position of the View, which the View's margin is already taken
 *                   into account
 * @param right      the right position of the flex line where the View belongs to. The actual
 *                   View's right position is shifted depending on the isRtl and alignItems
 *                   attributes
 * @param bottom     the bottom position of the View, which the View's margin is already taken
 *                   into account
 * @see #getAlignItems()
 * @see #setAlignItems(int)
 * @see LayoutParams#alignSelf
 */
private void layoutSingleChildVertical(View view, FlexLine flexLine, boolean isRtl, int alignItems, int left,
        int top, int right, int bottom) {
    LayoutParams lp = (LayoutParams) view.getLayoutParams();
    if (lp.alignSelf != LayoutParams.ALIGN_SELF_AUTO) {
        // Expecting the values for alignItems and alignSelf match except for ALIGN_SELF_AUTO.
        // Assigning the alignSelf value as alignItems should work.
        alignItems = lp.alignSelf;
    }
    int crossSize = flexLine.mCrossSize;
    switch (alignItems) {
    case ALIGN_ITEMS_FLEX_START: // Intentional fall through
    case ALIGN_ITEMS_STRETCH: // Intentional fall through
    case ALIGN_ITEMS_BASELINE:
        if (!isRtl) {
            view.layout(left + lp.leftMargin, top, right + lp.leftMargin, bottom);
        } else {
            view.layout(left - lp.rightMargin, top, right - lp.rightMargin, bottom);
        }
        break;
    case ALIGN_ITEMS_FLEX_END:
        if (!isRtl) {
            view.layout(left + crossSize - view.getMeasuredWidth() - lp.rightMargin, top,
                    right + crossSize - view.getMeasuredWidth() - lp.rightMargin, bottom);
        } else {
            // If the flexWrap == FLEX_WRAP_WRAP_REVERSE, the direction of the
            // flexEnd is flipped (from left to right).
            view.layout(left - crossSize + view.getMeasuredWidth() + lp.leftMargin, top,
                    right - crossSize + view.getMeasuredWidth() + lp.leftMargin, bottom);
        }
        break;
    case ALIGN_ITEMS_CENTER:
        int leftFromCrossAxis = (crossSize - view.getMeasuredWidth()) / 2;
        if (!isRtl) {
            view.layout(left + leftFromCrossAxis + lp.leftMargin - lp.rightMargin, top,
                    right + leftFromCrossAxis + lp.leftMargin - lp.rightMargin, bottom);
        } else {
            view.layout(left - leftFromCrossAxis + lp.leftMargin - lp.rightMargin, top,
                    right - leftFromCrossAxis + lp.leftMargin - lp.rightMargin, bottom);
        }
        break;
    }
}

From source file:android.support.design.widget.CoordinatorLayout.java

/**
 * CORE ASSUMPTION: anchor has been laid out by the time this is called for a given child view.
 *
 * @param child child to lay out//w w w .j a  v a 2  s .  co  m
 * @param anchor view to anchor child relative to; already laid out.
 * @param layoutDirection ViewCompat constant for layout direction
 */
private void layoutChildWithAnchor(View child, View anchor, int layoutDirection) {
    final LayoutParams lp = (LayoutParams) child.getLayoutParams();

    final Rect anchorRect = acquireTempRect();
    final Rect childRect = acquireTempRect();
    try {
        getDescendantRect(anchor, anchorRect);
        getDesiredAnchoredChildRect(child, layoutDirection, anchorRect, childRect);
        child.layout(childRect.left, childRect.top, childRect.right, childRect.bottom);
    } finally {
        releaseTempRect(anchorRect);
        releaseTempRect(childRect);
    }
}

From source file:com.cxsplay.wallyskim.widget.flexbox.FlexboxLayout.java

/**
 * Place a single View when the layout direction is horizontal ({@link #mFlexDirection} is
 * either {@link #FLEX_DIRECTION_ROW} or {@link #FLEX_DIRECTION_ROW_REVERSE}).
 *
 * @param view       the View to be placed
 * @param flexLine   the {@link FlexLine} where the View belongs to
 * @param flexWrap   the flex wrap attribute of this FlexboxLayout
 * @param alignItems the align items attribute of this FlexboxLayout
 * @param left       the left position of the View, which the View's margin is already taken
 *                   into account/*from  w w w . j  a  v  a2 s.  c  om*/
 * @param top        the top position of the flex line where the View belongs to. The actual
 *                   View's top position is shifted depending on the flexWrap and alignItems
 *                   attributes
 * @param right      the right position of the View, which the View's margin is already taken
 *                   into account
 * @param bottom     the bottom position of the flex line where the View belongs to. The actual
 *                   View's bottom position is shifted depending on the flexWrap and alignItems
 *                   attributes
 * @see #getAlignItems()
 * @see #setAlignItems(int)
 * @see LayoutParams#alignSelf
 */
private void layoutSingleChildHorizontal(View view, FlexLine flexLine, @FlexWrap int flexWrap, int alignItems,
        int left, int top, int right, int bottom) {
    LayoutParams lp = (LayoutParams) view.getLayoutParams();
    if (lp.alignSelf != LayoutParams.ALIGN_SELF_AUTO) {
        // Expecting the values for alignItems and alignSelf match except for ALIGN_SELF_AUTO.
        // Assigning the alignSelf value as alignItems should work.
        alignItems = lp.alignSelf;
    }
    int crossSize = flexLine.mCrossSize;
    switch (alignItems) {
    case ALIGN_ITEMS_FLEX_START: // Intentional fall through
    case ALIGN_ITEMS_STRETCH:
        if (flexWrap != FLEX_WRAP_WRAP_REVERSE) {
            view.layout(left, top + lp.topMargin, right, bottom + lp.topMargin);
        } else {
            view.layout(left, top - lp.bottomMargin, right, bottom - lp.bottomMargin);
        }
        break;
    case ALIGN_ITEMS_BASELINE:
        if (flexWrap != FLEX_WRAP_WRAP_REVERSE) {
            int marginTop = flexLine.mMaxBaseline - view.getBaseline();
            marginTop = Math.max(marginTop, lp.topMargin);
            view.layout(left, top + marginTop, right, bottom + marginTop);
        } else {
            int marginBottom = flexLine.mMaxBaseline - view.getMeasuredHeight() + view.getBaseline();
            marginBottom = Math.max(marginBottom, lp.bottomMargin);
            view.layout(left, top - marginBottom, right, bottom - marginBottom);
        }
        break;
    case ALIGN_ITEMS_FLEX_END:
        if (flexWrap != FLEX_WRAP_WRAP_REVERSE) {
            view.layout(left, top + crossSize - view.getMeasuredHeight() - lp.bottomMargin, right,
                    top + crossSize - lp.bottomMargin);
        } else {
            // If the flexWrap == FLEX_WRAP_WRAP_REVERSE, the direction of the
            // flexEnd is flipped (from top to bottom).
            view.layout(left, top - crossSize + view.getMeasuredHeight() + lp.topMargin, right,
                    bottom - crossSize + view.getMeasuredHeight() + lp.topMargin);
        }
        break;
    case ALIGN_ITEMS_CENTER:
        int topFromCrossAxis = (crossSize - view.getMeasuredHeight() + lp.topMargin - lp.bottomMargin) / 2;
        if (flexWrap != FLEX_WRAP_WRAP_REVERSE) {
            view.layout(left, top + topFromCrossAxis, right, top + topFromCrossAxis + view.getMeasuredHeight());
        } else {
            view.layout(left, top - topFromCrossAxis, right, top - topFromCrossAxis + view.getMeasuredHeight());
        }
        break;
    }
}