@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { int childLeft = getPaddingLeft(); int childRight = r - l - getPaddingRight(); int childTop = getPaddingTop(); int childBottom = b - t - getPaddingBottom(); if(mLabelView != null){ mLabelView.layout(childLeft, childTop, childRight, childTop + mLabelView.getMeasuredHeight()); childTop += mLabelView.getMeasuredHeight(); } if(mSupportView != null){ mSupportView.layout(childLeft, childBottom - mSupportView.getMeasuredHeight(), childRight, childBottom); childBottom -= mSupportView.getMeasuredHeight(); } mInputView.layout(childLeft, childTop, childRight, childBottom); }
@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); }
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { if (!mHasSelectorWheel) { super.onLayout(changed, left, top, right, bottom); return; } final int msrdWdth = getMeasuredWidth(); final int msrdHght = getMeasuredHeight(); // Input text centered horizontally. final int inptTxtMsrdWdth = mInputText.getMeasuredWidth(); final int inptTxtMsrdHght = mInputText.getMeasuredHeight(); final int inptTxtLeft = (msrdWdth - inptTxtMsrdWdth) / 2; final int inptTxtTop = (msrdHght - inptTxtMsrdHght) / 2; final int inptTxtRight = inptTxtLeft + inptTxtMsrdWdth; final int inptTxtBottom = inptTxtTop + inptTxtMsrdHght; mInputText.layout(inptTxtLeft, inptTxtTop, inptTxtRight, inptTxtBottom); if (changed) { // need to do all this when we know our size initializeSelectorWheel(); initializeFadingEdges(); mTopSelectionDividerTop = (getHeight() - mSelectionDividersDistance) / 2 - mSelectionDividerHeight; mBottomSelectionDividerBottom = mTopSelectionDividerTop + 2 * mSelectionDividerHeight + mSelectionDividersDistance; } }
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { if (!mHasSelectorWheel) { super.onLayout(changed, left, top, right, bottom); return; } final int msrdWdth = getMeasuredWidth(); final int msrdHght = getMeasuredHeight(); // Input text centered horizontally. final int inptTxtMsrdWdth = mInputText.getMeasuredWidth(); final int inptTxtMsrdHght = mInputText.getMeasuredHeight(); final int inptTxtLeft = (msrdWdth - inptTxtMsrdWdth) / 2; final int inptTxtTop = (msrdHght - inptTxtMsrdHght) / 2; final int inptTxtRight = inptTxtLeft + inptTxtMsrdWdth; final int inptTxtBottom = inptTxtTop + inptTxtMsrdHght; mInputText.layout(inptTxtLeft, inptTxtTop, inptTxtRight, inptTxtBottom); if (changed) { // need to do all this when we know our size initializeSelectorWheel(); initializeFadingEdges(); mTopSelectionDividerTop = (getHeight() - mSelectionDividersDistance) / 2 - mSelectionDividerHeight; mBottomSelectionDividerBottom = mTopSelectionDividerTop + 2 * mSelectionDividerHeight + mSelectionDividersDistance; } }
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { final int msrdWdth = getMeasuredWidth(); final int msrdHght = getMeasuredHeight(); // Input text centered horizontally. final int inptTxtMsrdWdth = mSelectedText.getMeasuredWidth(); final int inptTxtMsrdHght = mSelectedText.getMeasuredHeight(); final int inptTxtLeft = (msrdWdth - inptTxtMsrdWdth) / 2; final int inptTxtTop = (msrdHght - inptTxtMsrdHght) / 2; final int inptTxtRight = inptTxtLeft + inptTxtMsrdWdth; final int inptTxtBottom = inptTxtTop + inptTxtMsrdHght; mSelectedText.layout(inptTxtLeft, inptTxtTop, inptTxtRight, inptTxtBottom); mSelectedTextCenterX = mSelectedText.getX() + mSelectedText.getMeasuredWidth() / 2; mSelectedTextCenterY = mSelectedText.getY() + mSelectedText.getMeasuredHeight() / 2; if (changed) { // need to do all this when we know our size initializeSelectorWheel(); initializeFadingEdges(); final int dividerDistance = 2 * mDividerThickness + mDividerDistance; if (isHorizontalMode()) { mLeftDividerLeft = (getWidth() - mDividerDistance) / 2 - mDividerThickness; mRightDividerRight = mLeftDividerLeft + dividerDistance; } else { mTopDividerTop = (getHeight() - mDividerDistance) / 2 - mDividerThickness; mBottomDividerBottom = mTopDividerTop + dividerDistance; } } }