Recently in doing a Viewpager + fragment switch page, one of the fragment to open the camera, need to surfaceview, but when switching to the fragment of the former, this fragment is also loaded. Cause the card and flash a black screen.
Black screen Resolution:
The OnCreate method in the main fragmentacivity
GetWindow (). SetFormat (pixelformat.translucent);
Slow Load method
The Viewpager mechanism is that when a view is loaded, the previous one is retained, the current view is displayed, the pre-loaded view is present, and if the latter view is a more time-consuming page, it causes the comparison card to be displayed.
Resolved in
Fragment's
@Override
public void Setuservisiblehint (Boolean isvisibletouser) {
Super.setuservisiblehint (Isvisibletouser);
True when current fragment is displayed, not displayed as false
if (Isvisibletouser) {
Loading data
}
}
Android Surfaceview black screen