Prevent StatusBar from showing when using AlertDialog.Builder

前端 未结 5 813
半阙折子戏
半阙折子戏 2021-01-22 10:34

In the XML of my MainActivity, I have programmed it so that it uses a theme with NoActionBar and therefore there is no ac

5条回答
  •  礼貌的吻别
    2021-01-22 11:00

    You should use on style.xml

    
        
    
    

    It makes your activity without your ActionBar!

    UPDATED:

    I have some code, It should works on you!

    ab = new AlertDialog.Builder(MainActivity.this,
                        AlertDialog.THEME_DEVICE_DEFAULT_DARK);
    
                ab.setNeutralButton("OK", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface arg0, int arg1) {
                    }
                });
    
                ab.setTitle(R.string.welcome_title);
                ab.setMessage(R.string.message);
                ab.create().show();
    

    UPDATED2:

    here some code on Java

    requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
            setContentView(R.layout.main);
    

    and some on XML

    
    
    

    Hope it be helpful!

提交回复
热议问题