Change Action Bar title with Tab Bar

1

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

    
asked by anonymous 10.06.2015 / 19:58

2 answers

2

You need to do SetTitle () on ActionBar every time you change Activity. You can use the direct title of Activity

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

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

getActionBar().setTitle(this.getResources().getString(R.string.sua_string));
    
10.06.2015 / 21:17
0

Use this whenever an Activity is started.

Actionbar actionbar = getActionbar();

//Ou

Actionbar actionbar = getSupportActionBar();

actionbar.setTitle("Digite ou chame seu titulo aqui");
    
10.05.2017 / 22:05