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
34
votes
18 answers

Set a title in Toolbar from fragment in Android

I have been using the latest Toolbar from AppCompatv7 lib.I have placed a textview in the ToolBar ViewGroup And I want to set a title into this Textview from the fragment in my activity.In case of a custom action bar…
AndroidMech
  • 1,676
  • 3
  • 20
  • 31
33
votes
7 answers

How does the Android L contacts app collapse its toolbar?

I've been trying to reproduce the way that the Contacts app on version 5.0 collapses the toolbar when the listview is scrolled. Gallery of screenshots demonstrating the desired interaction Note the collapse of the toolbar in stages, where it…
32
votes
1 answer

Modal BottomSheetDialog with fullscreen ToolBar and Softkeyboard

How is it possible to create a modal BottomSheetDialog(Fragment) which switches to fullscreen with a ToolBar as shown in the Material Design Spec? I could add a ToolBar manually by adding a BottomSheetBehavior.BottomSheetCallback and setting the…
dipdipdip
  • 2,326
  • 1
  • 21
  • 31
32
votes
2 answers

CollapsingToolbarLayout title as a shared element transition

I have a TextView in my activity A. How can I make shared element transition of TextView from activity A and a title of CollapsingToolbarLayout.setTitle() from activity B? Is there way to obtain its title view id from CollapsingToolbarLayout's…
32
votes
2 answers

Use Toolbar across all activities (Android)

I'm using a Toolbar to replace the ActionBar. All is going well with one problem: The toolbar shows only on the main activity. If I try call the toolbar on any activity the same way I did with the main activity the app will crash when I call that…
Yousef Imran
  • 1,071
  • 2
  • 10
  • 16
31
votes
6 answers

Add custom view to the right of toolbar

I am trying to achieve this(A timer in toolbar with red background): I am trying to add customView in toolbar. It always end's up being on extreme left just beside the back arrow. Like the text YP in image below is a custom Textview added to…
Shubham
  • 3,071
  • 3
  • 29
  • 46
31
votes
8 answers

How to add dividers between specific menu items?

Background I have a menu item in the action bar (toolbar actually) that when clicked, shows a list of items to choose from, similar to radio-buttons:
android developer
  • 114,585
  • 152
  • 739
  • 1,270
31
votes
5 answers

New Android Design Library bug with AppBarLayout and Toolbar

I am using the new Android Design Library based on this example chrisbanes/cheesesquare in github and here I have run the example and I am having problems with Toolbar inside CheeseDetailActivity. The toolbar isnt shown as it should. Have a look at…
Ultimo_m
  • 4,724
  • 4
  • 38
  • 60
30
votes
6 answers

Android toolbar elevation when scrolling

I try to implement a search bar like in google maps android app: When the recycler view is in its initial state, the toolbar has no elevation. Only when the users starts scrolling the elevation becomes visible. And the search bar (toolbar) never…
DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
30
votes
10 answers

Hiding Toolbar on scroll with recyclerview inside fragment

I'm trying to get the toolbar to collapse on scroll when a recyclerview inside a fragment is scrolled. To start, heres my main layout:
30
votes
4 answers

How can I style the SearchView when using a Toolbar as an Action Bar?

I'm using a Toolbar as an Action Bar in my app using the AppCompat v21 library, as described in this post on the Android Developers Blog. I've styled the action bar using theThemeOverlay.AppCompat.Dark.ActionBar theme so that the text is light.…
30
votes
8 answers

Disable hamburger to back arrow animation on Toolbar

It's very easy to implement Toolbar with hamburger to back arrow animation. In my opinion this animation is pointless because as per material design spec navigation drawer covers the Toolbar when opened. My question is how to properly disable this…
tomrozb
  • 25,773
  • 31
  • 101
  • 122
29
votes
2 answers

Remove large padding after hamburger (menu) icon in Android Toolbar?

Here is a picture of the large padding gap after the menu icon: This occurred after not working on my project for a month (summer school). I just came back to it and noticed this larger than normal gap on the toolbar after I updated Android Studio.…
David Velasquez
  • 2,346
  • 1
  • 26
  • 46
29
votes
1 answer

How can I use VectorDrawable with the Android Toolbar?

What is the proper method to use the new VectorDrawable in the toolbar? I tried to use the app:srcCompat element as illustrated below, but nothing showed up.
vwrynn
  • 365
  • 1
  • 3
  • 9
29
votes
5 answers

CollapsingToolBarLayout - status bar scrim color doesn't change

I updated my android studio few days ago and started working with the CoordinatorLayout and CollapsingToolbarLayout just trying stuff. It seems that the Toolbar scrim colour override the status bar initial colour and the status bar scrim colour…