微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android工程师

download:Android工程师

移动端市场份额第一,物联网时代落地载体
Android不只能开发App,Android是一个生态系统
Googl不倒,Android不灭,Android不仅能开发App,在物联网,智能家居,车载设备都大有可为。

        canvas.drawLine(x1, y1, x2, y2, scoreRingPaint);
        axisLablePaint.setTextSize(axisLableTextSize);
        axisLablePaint.setTextAlign(Paint.Align.CENTER);
        axisLablePaint.setColor(mInnerscoreRingColor);
        float axisLable_fonth = getFontHeight(axisLablePaint);
        float labelRadius =innerscoreDiameter/2 - inner_ringWidth - axisLable_fonth/2 + 3;
        float x3 =  (float) (centerX + labelRadius * sinValue);
                float y3  =(float) (centerY + labelRadius * cosValue);
        canvas.save();
        canvas.rotate(90+ degree,x3,y3);    //绘製倾斜文字
        canvas.drawText(axisLabelStrs[i],x3,y3 + getFontCenterYToBaseLine(axisLablePaint),axisLablePaint);
        canvas.restore();
    }
    scoreTextPaint.setTextAlign(Paint.Align.CENTER);
    scoreTextPaint.setTextSize(scoreTextSize);
    scoreTextPaint.setColor(mscoreColor);
    double rAngle = Math.toradians(90 - (-180 + offset_degree));    //弧度
    float offset_y = (float)(maxOutterscoreRadius*Math.cos(rAngle));
    float scoreBaselineY = centerY + offset_y;
    float tempH = getFontTopYToBaseline(scoreTextPaint);
    canvas.drawText(nFormat.format(score), centerX, scoreBaselineY, scoreTextPaint);
    scoreTextPaint.setTextSize(scoreTitleTextSize);
    scoreTextPaint.setColor(mscoreTitleColor);
    float scoreTitleBaselineY = scoreBaselineY - tempH - Tool.dpToPx(2);
    canvas.drawText(mscoreTitleStr, centerX, scoreTitleBaselineY, scoreTextPaint);
}
public static float getFontHeight(Paint textPaint){
    Paint.FontMetrics fm = textPaint.getFontMetrics();
    return (float)Math.ceil(fm.descent - fm.ascent) + 3;
}
public static float getFontTopYToBaseline(Paint textPaint){
    Paint.FontMetrics fm = textPaint.getFontMetrics();
    return (float)Math.ceil(-fm.ascent) + 3;
}
public static float getFontBottomYToBaseline(Paint textPaint){
    Paint.FontMetrics fm = textPaint.getFontMetrics();
    return (float)Math.ceil(fm.descent) + 3;
}
public static float getFontCenterYToBaseLine(Paint textPaint){
    Paint.FontMetrics fm = textPaint.getFontMetrics();
    float fonth = getFontHeight(textPaint);
    return (float)Math.abs(Math.ceil(fonth/2- fm.descent));
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐