Switch from full screen to full screen pop / slide

Switching from full screen to full screen with Android works great. However, returning from my full-screen activity (full-screen video player), the activity pops up when the status bar goes down. It seems that renewable activity is animated from full screen mode, but the actual activity is not displayed in the status bar, as if it were absent.

I tried messing around with a manifest file defining themes / styles. I tried to do this programmatically in onCreate () before the content presentation was configured, and in other places in the activity lifecycle:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

It seems that there is no way to keep the status bar from animating down and / or from the content view from the first drawing without the status bar, and then adjust it as it is displayed again.

Anyone have any thoughts on this? I am not sure if there is a way to change this and just the behavior of Android.

Thanks in advance.

+5
source share
7 answers

You need a few more flags: FLAG_LAYOUT_IN_SCREEN and FLAG_LAYOUT_NO_LIMITS.

Check out http://nubinewsblog.blogspot.com/2009/11/smooth-full-screen-transition.html .

+2
source
private void toggleFullscreen(boolean fullscreen)
{
    WindowManager.LayoutParams attrs = getWindow().getAttributes();
    if (fullscreen)
    {
        attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
    }
    else
    {
        attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
    }
    getWindow().setAttributes(attrs);
}

Use it, it will certainly work

+2
source

Android: paddingTop = "25dp"

onCreate setContentView()

 getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
 getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
+1

:

, .

@Override
public void onBackPressed() {
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

    mUIHandler.post(new Runnable() {
        @Override
        public void run() {
            MyFullScreenActivity.super.onBackPressed();
        }
    });
}
+1

:

private void setFullscreen(boolean fullscreen) {
    WindowManager.LayoutParams attrs = getWindow().getAttributes();
    if (fullscreen) {
        attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
        attrs.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
        attrs.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
    }
    else {
        attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
        attrs.flags &= ~WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
        attrs.flags &= ~WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
    }
    getWindow().setAttributes(attrs);
}

super.onCreate(...) .

+1

.

  • Theme.AppCompat.Light.NoActionBar Activity, .

  • Activity onCreate(Bundle savedInstanceState) WindowManager.LayoutParams attributes = getWindow(). GetAttributes();   attributes.flags | = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;   GetWindow() SetAttributes ();.

, . :)

0

I don't know if this will work for you, but it worked for me. Set full-screen activity:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.my_screen);

disable full screen mode:

WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setAttributes(attrs);
startActivity(new Intent(getBaseContext(),NewActivity.class));
finish();
0
source

All Articles