search

Home  >  Q&A  >  body text

canvas - Android绘图实现圆角矩形的内阴影

需要实现类似上图的效果,在不用美工切图的情况下使用canvas画图如何实现

伊谢尔伦伊谢尔伦2768 days ago611

reply all(4)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 17:09:59

    Canvas draws 2 semicircles on both sides according to the coordinates, and draws a rectangle in the middle

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:09:59

    You can use canvas.drawRoundRect(); method.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 17:09:59

    I can only say that cutting the image will save a lot of trouble. Cut the .9.png image. I have not tried the code implementation, so I will mark it first.

    reply
    0
  • 黄舟

    黄舟2017-04-17 17:09:59

    pseudo code:

    beginPath();
    lineTo();
    quadraticCurveTo();
    lineTo();
    quadraticCurveTo();
    endPath();

    reply
    0
  • Cancelreply