小编ral*_*abb的帖子

在弧的起点和终点上绘制圆

嗨我很难在弧的两端绘制点(开始和结束)

虽然我可以在画布上绘制弧线.下面是我绘制弧线的示例代码.

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    float width = (float) getWidth();
    float height = (float) getHeight();
    float radius;

    if (width > height) {
        radius = height / 4;
    } else {
        radius = width / 4;
    }

    float center_x, center_y;
    final RectF oval = new RectF();

    center_x = width / 2;
    center_y = height / 2;

    oval.set(center_x - radius,
            center_y - radius,
            center_x + radius,
            center_y + radius);

    float percent = 25;
    float arcRadius = 360;
    float …
Run Code Online (Sandbox Code Playgroud)

android view draw android-custom-view ondraw

3
推荐指数
1
解决办法
2415
查看次数

标签 统计

android ×1

android-custom-view ×1

draw ×1

ondraw ×1

view ×1