Error when refreshing View on top of SurfaceView

前端 未结 1 1643
盖世英雄少女心
盖世英雄少女心 2020-12-10 21:40

I met the problem when I want to display a normal view object on top a surfaceview. The problem is: If I set the visibility of the normal view to invisible in the layout xml

相关标签:
1条回答
  • 2020-12-10 22:37

    Problem solved.

    the course is:

    1. The subscribe dialog widget is initialized as invisible during inflating the activity layout.
    2. And then the SurfaceView used for playing video is attached to the activity window.
    3. When the SurfaceView invokes mParent.requestTransparentRegion(this); in the callback onAttachedToWindow(), the dialog widget is invisible
    4. When ViewRoot calculate the transparent region, the overlapped area is considered invisible, and then the painting of the area is incorrect.

    To fix this issue, please call requestTransparentRegion when you change the visibility of the widget if it is not visible when SurfaceView is attached to window.

    For example, you can call mWidget.getParent().requestTransparentRegion(mSurfaceView).

    Since the ViewRoot is the root parent of the view hierachy, this will take the same effect to call SurfaceView’s parent to request transparentRegion.

    0 讨论(0)
提交回复
热议问题