如何在android中textview的内容添加笔划

我不想使用图像资源。 textview中的文本应该像上面的image.Is有任何方式可能做这种风格无论是在XML或在Java / KOTLIN代码。 另外我不想用帆布画。 请帮忙。

看看这个库

 

例2

  

在互联网上find的地方。 我创建了一个自定义的textview,并在onDraw方法中使用了下面的代码,它使用canvas绘制创建textview效果的文本轮廓。

  override fun onDraw(canvas: Canvas?) { super.onDraw(canvas) if(strokeColor!=null) { val textColor = textColors val paint = this.paint paint.style = Paint.Style.STROKE paint.strokeJoin = strokeJoin paint.strokeMiter = strokeMiter //10f this.setTextColor(strokeColor) paint.strokeWidth = strokeWidth //15f super.onDraw(canvas) paint.style = Paint.Style.FILL setTextColor(textColor) super.onDraw(canvas) } }