Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change toolbar in a fragment?

I have two fragments, one is for folder and other is for photos in Tab layout. Photos fragment have many photos when I select one item(picture) I want to change the toolbar entirely like

below

enter image description here

how i will do this and have to listen clicks events on toolbar?

like image 750
Usman Saeed Avatar asked Dec 11 '25 13:12

Usman Saeed


1 Answers

just put it in your fragment get your Actvity toolbar with id and set toolbar as u desired in your fragment

Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("title");
like image 78
Babul Avatar answered Dec 14 '25 12:12

Babul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!