Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action Bar Title with more than one line?

Is it possible to create the title in the Action Bar with more than one line? I need a double spaced title.

like image 492
benkap Avatar asked Jun 29 '12 09:06

benkap


1 Answers

I am not quite sure if you were looking for the following, but:

actionBar.setSubtitle(String string) sets a second line with smaller font underneath your main Title.

example:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_left_drawer_item_clicked);
        String value = getIntent().getExtras().getString("drawerItemString");

        ActionBar actionBar = getActionBar();
        // Make sure we're running on Honeycomb or higher to use ActionBar APIs
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            // Show the Up button in the action bar.
            actionBar.setDisplayHomeAsUpEnabled(true);
        }
        actionBar.setTitle(selectedBook.getTitle());
        actionBar.setSubtitle(selectedBook.getAuthorName());

}
like image 167
Thomas v d O Avatar answered Oct 16 '22 13:10

Thomas v d O