N
N
NestOleh2015-11-03 16:39:47
Android
NestOleh, 2015-11-03 16:39:47

How to replace the "hamburger" toolbar button with a back arrow for a specific fragment?

There is MainActivity with Tollbar and FrameLayout, fragments are changed through NavigationDrawer, everything is standard. In one of the fragments there is a list, when you click on a list element, a new fragment opens with a description of the list element.
It is necessary that in the fragment with the description of the list in the toolbar there was not a "hamburger" button, but a button with an arrow back, which would return back to the fragment with the list, and not open the NavigationDrawer. How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lomikman, 2015-11-12
@lomikman

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); // or if you will do it in a fragment then getActivity().findViewById....
toolbar.setNavigationIcon(R.drawable.icon_close);
icon_close you add to the project yourself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question