【问题标题】:Bad performance with Paint.Style.STROKE and drawTextPaint.Style.STROKE 和 drawText 性能不佳
【发布时间】:2013-04-10 07:38:42
【问题描述】:

我的三星 Galaxy S3 和自定义 TextView 组件面临巨大的性能问题。

我已经覆盖了onDraw 方法:

canvas.drawText(getText().toString(), x, y, borderPaint);
canvas.drawText(getText().toString(), x, y, textPaint);

问题在于borderPaint 使用Paint.Style.STROKE。如果我将该属性注释掉,一切都会顺利进行,但我需要它来为我的TextView 绘制边框

谢谢。

【问题讨论】:

    标签: android performance android-widget


    【解决方案1】:

    不知道为什么STROKE 会导致问题,但我通过将文本绘制到Bitmap 然后在onDraw 方法中绘制Bitmap 来获得良好的性能。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-15
      • 1970-01-01
      • 2013-04-11
      • 1970-01-01
      • 2021-01-30
      • 1970-01-01
      • 2011-01-03
      • 2016-11-06
      相关资源
      最近更新 更多