BugView.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:Bugstick 作者:
@Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    canvas.drawColor(Color.BLACK);

    pathMeasure.setPath(path, false);
    float length = pathMeasure.getLength();

    if (length > BUG_TRAIL_DP * density) {
        // Note - this is likely a poor way to accomplish the result. Just for demo purposes.
        @SuppressLint("DrawAllocation")
        PathEffect effect = new DashPathEffect(new float[]{length, length}, -length + BUG_TRAIL_DP * density);
        paint.setPathEffect(effect);
    }

    paint.setStyle(Paint.Style.STROKE);
    canvas.drawPath(path, paint);

    paint.setStyle(Paint.Style.FILL);
    canvas.drawCircle(position.x, position.y, BUG_RADIUS_DP * density, paint);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号