Android Show Activity Title/status bar at the top after it is hidden

后端 未结 2 394
北恋
北恋 2021-01-12 17:59

Currently in my FragmentActivity, I hide the status bar by, in the onCreate method, doing the following:

 requestWindowFeature(Wind         


        
2条回答
  •  终归单人心
    2021-01-12 18:30

    There are couple of ways of doing so:

    First Approach:

    FEATURE_CUSTOM_TITLE

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.foo_layout);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_bar); 
    or
    
    youractivity.setTitle();
    

    NOTE! you can include a simple TextView in side your layout custom_title_bar

    Make you custom_title_bar layout as follows:

       
          
        
    

    Second Approach:

    Activity.setTitle

    this.setTitle("My Title!");
    

提交回复
热议问题