Skip to content

Commit

Permalink
解决ClipPagerTitleView设置中文不居中的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hackware1993 committed Nov 21, 2016
1 parent 13b81fa commit 5b0bc2c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ private int measureHeight(int heightMeasureSpec) {
@Override
protected void onDraw(Canvas canvas) {
int x = (getWidth() - mTextBounds.width()) / 2;
int y = (getHeight() + mTextBounds.height()) / 2;
Paint.FontMetrics fontMetrics = mPaint.getFontMetrics();
int y = (int) (getHeight() / 2 - fontMetrics.bottom / 2 - fontMetrics.top / 2);

// 画底层
mPaint.setColor(mTextColor);
Expand Down

0 comments on commit 5b0bc2c

Please sign in to comment.