V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
lanxiner
V2EX  ›  Android

canvas 绘制端点的圆角

  •  
  •   lanxiner · Feb 25, 2022 · 13326 views
    This topic created in 1532 days ago, the information mentioned may be changed or developed.

    使用 canvas 的 drawPath 方法绘制的一个箭头符号,如何让红色箭头区域也是圆角? 或者有其他的方法可以方便的绘制出圆角. https://hailong-test.cdn.bcebos.com/A2D75162-3F3D-4C18-A1CB-5CF3962E0799.png

    6 replies    2022-02-25 19:00:29 +08:00
    xiyuesaves
        1
    xiyuesaves  
       Feb 25, 2022
    在两端画个圆?
    TwilightCool
        2
    TwilightCool  
       Feb 25, 2022
    ctx.lineCap="round"
    TwilightCool
        3
    TwilightCool  
       Feb 25, 2022
    看错了 Android 下就不知道了
    Neoqee
        4
    Neoqee  
       Feb 25, 2022
    paint 对象应该有个属性可以设置为画线的时候就头尾是圆角吧。
    U7Q5tLAex2FI0o0g
        5
    U7Q5tLAex2FI0o0g  
       Feb 25, 2022
    pathPaint.setStrokeCap(Paint.Cap.ROUND)
    jones2000
        6
    jones2000  
       Feb 25, 2022
    自己画箭头,画 2 条线就可以, 然后线段设置为圆角
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4173 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 05:08 · PVG 13:08 · LAX 22:08 · JFK 01:08
    ♥ Do have faith in what you're doing.