在 AppActivity 类的 onCreate 方法中添加闪屏图

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        splashUIHandler = new Handler();
        addContentView(createSplashImage(), new WindowManager.LayoutParams(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN));
        if (!isTaskRoot()) {
            return;
        }
        SDKWrapper.getInstance().init(this);
    }
public ImageView createSplashImage() {
        splashImage = new ImageView(this);
        splashImage.setImageResource(R.drawable.splash_background);
        splashImage.setScaleType(ImageView.ScaleType.MATRIX);
        return  splashImage;
    } 

引擎加载完成后移除闪屏图

 public static void removeSplashImage() {
 // splashImage,即主线程里,所以我们只能通过子线程发送消息给主线程去跟新UI
    splashUIHandler.post(new Runnable() {
        @Override
        public void run() {
            if (splashImage!=null) {
                splashImage.setVisibility(View.GONE);
            }
        }
    });
}


关注【游戏讲坛】微信公众号,获取最新动态!