Questions tagged [android-toolbar]

A Toolbar is a widget based generalization of action bars for use within layouts.

The Toolbar was introduced in Android 5.0 Lollipop however it was also added to Added to appcompat-v7:21.0.0 for backwards compatibility. The widget consists of a navigation button, a title and subtitle, one or more custom views and an action menu. You should use Toolbar instead of Actionbar when you want to use the Actionbar features but you require more control over it's appearance, if you want multiple Actionbars, or if you want Actionbars that only take up part of the width of the screen.

For more information:

See also:

3112 questions
116
votes
13 answers

Creating a Preference Screen with support (v21) Toolbar

I was having trouble using the new Material Design toolbar in the support library on a Preference screen. I have a settings.xml file as below:
108
votes
12 answers

Cannot catch toolbar home button click event

I've implemented the newest appcompat library and using the Toolbar as action bar. But the problem is I cannot catch the home button / hamburger icon click event. I've tried and looked everything but doesn't seem to find a similar problem. This is…
Dark Leonhart
  • 1,494
  • 2
  • 13
  • 21
105
votes
1 answer

android toolbar popupTheme vs theme

Often I see this declaration of Toolbar in layout files:
105
votes
7 answers

How do I style appcompat-v7 Toolbar like Theme.AppCompat.Light.DarkActionBar?

I'm trying to recreate the look of Theme.AppCompat.Light.DarkActionBar with the new support library Toolbar. If I choose Theme.AppCompat.Light my toolbar will be light and if I choose Theme.AppCompat it will be dark. (Technically you have to use…
Liminal
  • 1,709
  • 2
  • 12
  • 15
104
votes
12 answers

Android Toolbar Adding Menu Items for different fragments

I have a toolbar as well as a navigation drawer. When I start my app, the toolbar and navigation drawer are created. When I click items in the navigation drawer, it starts new fragments and keeps the same toolbar. How do I basically add menu items…
Joe Eigi
  • 1,041
  • 2
  • 8
  • 8
98
votes
11 answers

Change Toolbar color in Appcompat 21

I am testing out the new Appcompat 21 Material Design features. Therefore I've created a Toolbar like this:
97
votes
3 answers

Android transparent status bar and actionbar

I've done a few researches on this topic and I couldn't find a complete solution so, step by step and with some trial and error, I finally find out how can we achieve these results: having a transparent or coloured Actionbar and Statusbar. See my…
95
votes
11 answers

Display ActionMode over Toolbar

I am trying to use the android.view.ActionMode with the new android.support.v7.widget.Toolbar, in addition to the traditional android.app.ActionBar. I am able to display it with: toolbar.startActionMode(callback); The problem is that the ActionMode…
92
votes
3 answers

what is exact difference between appbar, toolbar, actionbar ? and when to use them specifically?

what is exact difference between appbar, Toolbar, Actionbar? and when to use them specifically? I try to find about them but it make me confuse so can any buddy explain to me what is exact difference between them and when to use them or are this are…
92
votes
11 answers

How to remove white underline in a SearchView widget in Toolbar Android

I am using the Toolbar search widget in my project. Everything works fine but expect the thing which I am completely stuck up with removing the underline below the search field in my toolbar. I have tried many solutions and nothing works out. Below…
Chandru
  • 5,954
  • 11
  • 45
  • 85
85
votes
16 answers

Toolbar Navigation Hamburger Icon missing

I'm looking for a way to display the hamburger icon whitout using the Drawer/DrawerToggle and use the default icon included in Android By setting getSupportActionBar().setDisplayHomeAsUpEnabled(true); it display the back arrow but not the…
79
votes
18 answers

How to make Toolbar transparent?

It is self Q&A post I have transparent ActionBar which overlays layout. After migration to the latest support library I have been forced to get rid off the ActionBar in favor of the Toolbar. The old ways to make it transparent and overlay that…
Gleichmut
  • 5,953
  • 5
  • 24
  • 32
78
votes
4 answers

Expand/Collapse Lollipop toolbar animation (Telegram app)

I'm trying to figure out how the expand/collapse animation of the toolbar is done. If you have a look at the Telegram app settings, you will see that there is a listview and the toolbar. When you scroll down, the toolbar collapse, and when you…
72
votes
13 answers

Toolbar navigation icon never set

I'm trying the new Toolbar component and having some trouble with the navigation icon. I want to implement a custom icon for back navigation : In my manifest i set a parent to my activity :
70
votes
3 answers

How to set app:layout_scrollFlags for Toolbar programmatically

My app have a viewpager and 4 tabs, each tab have many fragment. But I just want my Toolbar scroll up/down while scrolling recyclerview in 2 specific tabs. But I don't know how to block Toolbar scroll for other tabs. I tried to import toolbar for…