沉浸式屏幕

时间:2017-05-10 03:28:44

标签: screen sticky android-immersive

我将以下代码用于沉浸式粘性屏幕。

公共类MainActivity扩展了AppCompatActivity {

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

@Override **//Here is get this notification that method does not overide 
            method from its superclass. If i remove the @Override and run the app it still runs work but without the immersive screen. How can i get it to work    

  public void onWIndowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    View decorView = getWindow().getDecorView();
    if(hasFocus){
        decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                |View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                |View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                |View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                |View.SYSTEM_UI_FLAG_FULLSCREEN
                |View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
    }

} } 请您帮忙..谢谢

0 个答案:

没有答案