private void relayout() { if (recyclerView != null) { recyclerView.measure(0, 0); recyclerView.layout(0, 0, 100, 1000); } }
rv.measure(makeSizeSpec(100, EXACTLY), makeSizeSpec(100, EXACTLY)); recyclerBinder.setSize(100, 100); rv.layout(0, 0, 100, 100);
rv.measure(makeSizeSpec(200, EXACTLY), makeSizeSpec(200, EXACTLY)); recyclerBinder.setSize(200, 200); rv.layout(0, 0, 200, 200);
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { final int left = getPaddingLeft(); final int top = getPaddingTop(); final int right = getMeasuredWidth() - getPaddingRight(); final int bottom = getMeasuredHeight() - getPaddingBottom(); // Layout the RecyclerView child spanning the whole view mRecyclerView.layout(left, top, right, bottom); // Calculations final int halfEditTextHeight = mEditText.getMeasuredHeight() / 2; final int centerY = (top + bottom) / 2; // Layout the EditText at the center mEditText.layout(left, centerY - halfEditTextHeight, right, centerY + halfEditTextHeight); }
void layoutVertical(boolean isTop) { int offset = mHTViewHolderTracker.getCurrentPos(); int size = mHTViewHolderTracker.getRefreshViewSize(); int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); int left, top, right, bottom; if (mRefreshContainerView != null) { left = paddingLeft; if (isTop) { top = -(size - paddingTop - offset); } else { top = mRecyclerView.getMeasuredHeight() - offset; } right = left + mRefreshContainerView.getMeasuredWidth(); bottom = top + mRefreshContainerView.getMeasuredHeight(); mRefreshContainerView.layout(left, top, right, bottom); } if (mRecyclerView != null) { left = paddingLeft; if (isTop) { top = paddingTop + offset; } else { top = paddingTop - offset; } right = left + mRecyclerView.getMeasuredWidth(); bottom = top + mRecyclerView.getMeasuredHeight(); mRecyclerView.layout(left, top, right, bottom); } }
void layoutHorizontal(boolean isLeft) { int offset = mHTViewHolderTracker.getCurrentPos(); int size = mHTViewHolderTracker.getRefreshViewSize(); int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); int left, top, right, bottom; if (mRefreshContainerView != null) { if (isLeft) { left = -(size - paddingLeft - offset); } else { left = mRecyclerView.getMeasuredWidth() - offset; } top = paddingTop; right = left + mRefreshContainerView.getMeasuredWidth(); bottom = top + mRefreshContainerView.getMeasuredHeight(); mRefreshContainerView.layout(left, top, right, bottom); } if (mRecyclerView != null) { if (isLeft) { left = paddingLeft + offset; } else { left = paddingLeft - offset; } top = paddingTop; right = left + mRecyclerView.getMeasuredWidth(); bottom = top + mRecyclerView.getMeasuredHeight(); mRecyclerView.layout(left, top, right, bottom); } }