Change Action Bar title with Tab Bar

Asked

Viewed 2,275 times

1

I have 3 Tab Bars that are at the bottom of the layout and the action bar at the top, as default. I need to know how to modify the title of my Action Bar every time a different Tab Bar is selected. Thanks.

2 answers

3

You need to Settitle() on Actionbar every time you change Activity. You can use to take the title directly from Activity

getActionBar().setTitle(MainActivity.class.getSimpleName());

Or you can put a custom title right from the Strings file.

getActionBar().setTitle(this.getResources().getString(R.string.sua_string));

0

Use this whenever an Activity is initialized.

Actionbar actionbar = getActionbar();

//Ou

Actionbar actionbar = getSupportActionBar();

actionbar.setTitle("Digite ou chame seu titulo aqui");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.