mLabelView.measure(ws, hs); labelWidth = mLabelView.getMeasuredWidth(); labelHeight = mLabelView.getMeasuredHeight(); ViewGroup.LayoutParams params = v.getLayoutParams(); int ws = getSpec(widthSize - paddingHorizontal, params.width); int hs = getSpec(heightSize - paddingVertical - mLabelView.getMeasuredHeight(), params.height);
height = Math.max(mText.getMeasuredHeight(), mAction.getMeasuredHeight());
@Override public int getBaseline() { View child = getSelectedView(); if (child != null) { final int childBaseline = child.getBaseline(); if(childBaseline < 0) return -1; int paddingTop = getPaddingTop(); if(mLabelView != null) paddingTop += mLabelView.getMeasuredHeight(); int remainHeight = getMeasuredHeight() - paddingTop - getPaddingBottom() - getDividerDrawableHeight(); int verticalGravity = mGravity & Gravity.VERTICAL_GRAVITY_MASK; switch (verticalGravity) { case Gravity.TOP: return paddingTop + childBaseline; case Gravity.BOTTOM: return paddingTop + remainHeight - child.getMeasuredHeight() + childBaseline; default: return (remainHeight - child.getMeasuredHeight()) / 2 + paddingTop + childBaseline; } } return -1; }
mTitle.measure(widthMs, heightMs); titleWidth = mTitle.getMeasuredWidth(); titleHeight = mTitle.getMeasuredHeight();
int top = getPaddingTop() + (mLabelView == null ? 0 : mLabelView.getMeasuredHeight()); int bottom = h - getDividerDrawableHeight() - getPaddingBottom(); if(mIsRtl) mLabelView.layout(childRight - mLabelView.getMeasuredWidth(), childTop, childRight, childTop + mLabelView.getMeasuredHeight()); else mLabelView.layout(childLeft, childTop, childLeft + mLabelView.getMeasuredWidth(), childTop + mLabelView.getMeasuredHeight()); childTop += mLabelView.getMeasuredHeight();
mTitle.layout(childRight - mTitle.getMeasuredWidth(), childTop, childRight, childTop + mTitle.getMeasuredHeight()); else mTitle.layout(childLeft, childTop, childLeft + mTitle.getMeasuredWidth(), childTop + mTitle.getMeasuredHeight()); childTop += mTitle.getMeasuredHeight();