Force a full screen Activity to remeasure/redraw on resume?

后端 未结 8 1186
后悔当初
后悔当初 2021-01-05 05:14

Edited to add more details: (originally asked nearly two months ago...still haven\'t found a solution)

I have an activity with a somewhat complicate

8条回答
  •  一整个雨季
    2021-01-05 05:28

    I have found a Solution to this:

        @Override
        protected void onResume() {
            Log.e("", "onResume");
            super.onResume();
    
            //this is a simple Splash with "Game paused" Text inside! in my main.xml
            final LinearLayout gamePause_text = (LinearLayout) findViewById(R.id.gamePause_text);
            OnGlobalLayoutListener asdf = new OnGlobalLayoutListener(){
                public void onGlobalLayout() {
                    Log.e("", "onGlobalLayout");
                    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                                         WindowManager.LayoutParams.FLAG_FULLSCREEN);
                    gameSurface.onResume(); //OpenGL Surface onResume();
                    gamePause_text.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            };
            gamePause_text.getViewTreeObserver().addOnGlobalLayoutListener(asdf);
        }
    

提交回复
热议问题