Android Invalidate() only single view

前端 未结 2 412
一个人的身影
一个人的身影 2021-01-23 02:03

I have 2 views on RelativeLayout

I need to invoke(call) onDraw only single view

when I try view1.invalidate(); it also invoke(call) on

2条回答
  •  無奈伤痛
    2021-01-23 02:20

    I met the same question.

    Finally, I found that drawing cache is disabled in android 2.3. Because of no cache, each time the view will redraw itself even the other invalidated.

    To make cache enable, use:

    setDrawingCacheEnabled(true)
    

    The question is too old, but google put it first when I searched. I think it is useful for others who get into here.

提交回复
热议问题