Setting Action Bar title and subtitle

后端 未结 12 734
盖世英雄少女心
盖世英雄少女心 2020-12-01 02:41

I want to set title and subtitile of my action bar before compile time. I got a way to do it like this:

ActionBar ab = getActionBar();
ab.setTitle(\"My Title         


        
12条回答
  •  北海茫月
    2020-12-01 03:14

    Nope! You have to do it at runtime.

    If you want to make your app backwards compatible, then simply check the device API level. If it is higher than 11, then you can fiddle with the ActionBar and set the subtitle.

    if(Integer.valueOf(android.os.Build.VERSION.SDK) >= 11){
        //set actionbar title
    }
    

提交回复
热议问题