首页 > 解决方案 > 画一个讲话泡泡

问题描述

我尝试使用以下代码在 Android 画布中绘制语音气泡,

private void drawBubble() {
    path.reset();
    path.moveTo(bounds.left, bounds.bottom);
    float percentage20 = bounds.height() * (20.0f / 100.0f);
    path.lineTo(bounds.left + percentage20, bounds.bottom - percentage20);
    RectF arcRect = new RectF(bounds.left, bounds.top, bounds.right, bounds.bottom - percentage20);
    path.addArc(arcRect, 130, 330);
    path.lineTo(bounds.left, bounds.bottom);
}

但这给了我以下输出。

在此处输入图像描述

正如您在这张图片中看到的,我无法将线与气泡连接起来。有人可以将我重定向到正确的路径吗?

更新 我改为addArcarcTo现在我的输出是,

在此处输入图像描述

标签: androidcanvaspath

解决方案


推荐阅读