Xiaogegexiao
Xiaogegexiao

Reputation: 111

How does Android youtube hide the system ui, even when the dialog pops up

I am currently using SystemUiHider for hiding the system status bar and navigation bar.

I came across with a issue that if I want to show a DialogFragment (which actually pops up a dialog), it does break the system ui hiding and show the status bar and navigation bar.

It looks like this enter image description here

You can see the screen got squashed after the dialog pop up

I thought what I want is the same effect as Youtube Android App

It looks like this enter image description here

After clicking on the option button on the screen top right, it pops up a dialog looking like this enter image description here

Which shows the status bar and navigation bar, but it is fine as it doesn't squash the actually video

So can anyone help me out of this? Thanks for any suggestion

I'm currently using SystemUiHider

mUIHider = SystemUiHider.getInstance(this, mContentFrame,
    SystemUiHider.FLAG_FULLSCREEN
    | SystemUiHider.FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES
    | SystemUiHider.FLAG_HIDE_NAVIGATION
    | SystemUiHider.FLAG_HIDE_IMMERSIVE_STICKY);
mUIHider.setup();
mUIHider.hide();

Upvotes: 0

Views: 506

Answers (1)

Innocent Kithinji
Innocent Kithinji

Reputation: 736

according to android using Immersive view will do. Like in the case below:

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (savedInstanceState == null) {
    }

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE);
}

Upvotes: 1

Related Questions