Hide Notification bar

后端 未结 9 1623
[愿得一人]
[愿得一人] 2020-11-27 03:17

Anyone know how to disable/hide notification bar at the top which show battery and other things in android. Any help will be appreciated.

EDIT: Plea

9条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 04:12

    Successfully implemented a slightly modified version of @Martin's suggestion along with a custom theme to get rid of BOTH the Status and Navigation Bar.

    public class MyActivity extends Activity {
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        //* Hides Notification Bar
        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    
        setContentView(R.layout.activity_my);
    }
    

    Top part is used to get rid of the Status bar. Add the following code to your @styles as a resource to kill off the NavBar as well.

       
    

    After you add this to your resource file, pop open AndroidManifest.xml and chance your application theme to "@style/NoNav".

    Android UI bloatware eliminated :)

提交回复
热议问题