Ich studiere die App so, .Wo sind die Ausgangswerte der Zahlen?
/**
* draw the hour text (12、3、6、9)
* draw the arc
*/
private void drawTimeText() {
//draw the hour text
String timeText = "12";
mTextPaint.getTextBounds(timeText, 0, timeText.length(), mTextRect);
int textLargeWidth = mTextRect.width();//两位数字的宽
mCanvas.drawText("12", getWidth()/2 - textLargeWidth/2, mPaddingTop + mTextRect.height(), mTextPaint);
timeText = "3";
mTextPaint.getTextBounds(timeText, 0, timeText.length(), mTextRect);
int textSmallWidth = mTextRect.width();//一位数字的宽
mCanvas.drawText("3", getWidth() - mPaddingRight - mTextRect.height()/2 - textSmallWidth/2,
getHeight()/2 + mTextRect.height()/2, mTextPaint);
mCanvas.drawText("6", getWidth()/2 - textSmallWidth/2, getHeight() - mPaddingBottom, mTextPaint);
mCanvas.drawText("9", mPaddingLeft + mTextRect.height()/2 - textSmallWidth/2,
getHeight()/2 + mTextRect.height()/2, mTextPaint);
//draw the arc
mCircleRectF.set(mPaddingLeft + mTextRect.height()/2 + mCircleStrokeWidth/2,
mPaddingTop + mTextRect.height()/2 + mCircleStrokeWidth/2,
getWidth() - mPaddingRight - mTextRect.height()/2 + mCircleStrokeWidth/2,
getHeight() - mPaddingBottom - mTextRect.height()/2 + mCircleStrokeWidth/2);
for (int i = 0; i < 4; i++) {
mCanvas.drawArc(mCircleRectF, 5 + 90 * i, 80, false, mCirclePaint);
}
ich weiß nicht, wenn die Stunde Text "3" zeichnen,
mCanvas.drawText("3", getWidth() - mPaddingRight - mTextRect.height()/2 - textSmallWidth/2,
getHeight()/2 + mTextRect.height()/2, mTextPaint);
Verwendung canvas.drawText(),
void drawText (String text,
int start,
int end,
float x,
float y,
Paint paint)
"y" bezeichnet die Anzahl von Basislinien Ich kenne die Regeln der Basislinie der Zahl nicht, wie "3", wo ist die Grundlinie der Zahl? Ich suche google die "Grundlinie", aber es nur über englische Grundlinie, nichts über die Grundlinie.
vielen dank !! –