Open imxiaopeng opened 4 years ago
private void verticalChildPositionLayout(View child, RectF rect, int targetParentPosition) { switch (targetParentPosition) { case LayoutParams.PARENT_CENTER: //rect.top = (mTargetRect.width() - child.getMeasuredHeight()) / 2; //rect.bottom = (mTargetRect.width() + child.getMeasuredHeight()) / 2; 应改为: rect.top = (mTargetRect.height() - child.getMeasuredHeight()) / 2; rect.bottom = (mTargetRect.height() + child.getMeasuredHeight()) / 2;
rect.offset(0, mTargetRect.top); break; } }
private void verticalChildPositionLayout(View child, RectF rect, int targetParentPosition) { switch (targetParentPosition) { case LayoutParams.PARENT_CENTER: //rect.top = (mTargetRect.width() - child.getMeasuredHeight()) / 2; //rect.bottom = (mTargetRect.width() + child.getMeasuredHeight()) / 2; 应改为: rect.top = (mTargetRect.height() - child.getMeasuredHeight()) / 2; rect.bottom = (mTargetRect.height() + child.getMeasuredHeight()) / 2;