Black screen problem when adding SurfaceView in ListView

Add in OnCreate
getActivity().getWindow().setFormat(PixelFormat. TRANSLUCENT ) ;
Solve the problem of a black screen.
This sentence enables the window to support transparency and then you can use functions such as setAlpha, drawColor to set the window transparency PixelFormat .TRANSPARENT and PixelFormat.TRANSLUCENT have similar functions, both of which make the window support transparency

Add in OnCreate

getActivity().getWindow().setFormat(PixelFormat. TRANSLUCENT ) ;< /span>

Solve the problem of a black screen.

This sentence enables the window to support transparency and then you can use functions such as setAlpha, drawColor to set the degree of transparency of the window. PixelFormat.TRANSPARENT and PixelFormat.TRANSLUCENT have similar functions, both Make the window support transparency

Leave a Comment

Your email address will not be published.