How to dynamically change the tablayout and toolbar color, while navigating through other fragment pager?
I want to add different color to my all fragmentpageradapter.
How to dynamically change the tablayout and toolbar color, while navigating through other fragment pager?
I want to add different color to my all fragmentpageradapter.
Latest SDK APIs let's you treat the support Toolbar (android.support.v7.widget.Toolbar
) like any other vie in your app. So I would expect something like this inside your onStart()
call:
actionBar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
setSupportActionBar(actionBar);
super.onStart();
Once you succesfully obtained this reference, you can change the Bar's color dynamically acting on its background, like how you would with another kind of view. Have a look to this answer for an example; you may also find this tutorial useful