When it's necessary to execute invalidate() on a View?

后端 未结 4 1894
予麋鹿
予麋鹿 2020-12-02 12:15

My answer to this question was just accepted but I started to wonder when exactly one needs to invalidate() a View and when it is not necessary?

After a bit of think

4条回答
  •  日久生厌
    2020-12-02 12:53

    I had this problem when I wanted to draw a textPaint! My code was

        canvas.drawPaint(textPaintNumber)
        canvas.drawText("MyText", 30F, 63F, textPaintNumber)
    

    I cleared the first lint and the problem was solved

        canvas.drawText("MyText", 30F, 63F, textPaintNumber)
    

提交回复
热议问题