Extended SurfaceView's onDraw() method never called

后端 未结 4 1856
萌比男神i
萌比男神i 2020-11-29 22:22

I\'m trying to modify the SurfaceView I use for doing a camera preview in order to display an overlaying square. However, the onDraw method of the extended SurfaceView is ne

4条回答
  •  甜味超标
    2020-11-29 22:56

    Based on all above comments I used :

    Add setWillNotDraw(false) in the onAttachedToWindow() event.

    @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); setWillNotDraw(false); }

    and it worked.

提交回复
热议问题