How to remove the title when launching android app?

前端 未结 12 1931
死守一世寂寞
死守一世寂寞 2021-02-06 10:43

I already remove the title in onCreate() method.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(         


        
相关标签:
12条回答
  • 2021-02-06 11:29

    Set your splashscreen as your main activity and set the theme to

    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    

    create and intent to move your splash screen to your actual main activity

    0 讨论(0)
  • 2021-02-06 11:32

    Do this in your onCreate() method.

    //Remove title bar

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    

    //Remove notification bar

    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    this refers to the Activity.

    ===========

    EDIT:

    if you are using ActionBarSherLock

    final ActionBar bar = getSupportActionBar();
    bar.setDisplayShowTitleEnabled(false);
    
    0 讨论(0)
  • 2021-02-06 11:35

    Hope below lines will help you

        getWindow().clearFlags(
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); 
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    
    0 讨论(0)
  • 2021-02-06 11:38

    Nick Butcher and Katherine Kuan wrote a nice Google Plus post about a smoother app launch experience:

    https://plus.google.com/+AndroidDevelopers/posts/VVpjo7KDx4H

    However, if you want to be compatible with Android versions below API 14 (for example using AppCompat), the only way I could achieve this is by using a separate launch activity using a theme with no actionbar.

    0 讨论(0)
  • 2021-02-06 11:41

    Put below three line in onCreate Method before setContentview in your activity which want to display full screen

    requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    0 讨论(0)
  • 2021-02-06 11:42

    Use this:

     ActionBar bar = getActionBar();    
     bar.hide();
    

    or

        ActionBar bar = getActionBar();
        bar.setDisplayShowHomeEnabled(false);
        bar.setDisplayShowTitleEnabled(false);
    
    0 讨论(0)
提交回复
热议问题