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
46
votes
10 answers

AppBarLayout with FrameLayout container as scrolling content doesn't work

I'm trying to use the newest design library to make my toolbar hide/show on scroll. My issue is the scrolling content I have is in the fragment, I'm just injecting it into the FrameLayout container and it doesn't work. Here's my activity:…
45
votes
9 answers

How to display menu item with icon and text in AppCompatActivity

I tried different combinations in xml file:
Yarh
  • 4,459
  • 5
  • 45
  • 95
44
votes
9 answers

How to center toolbar back button?

I'm having a problem trying to center the back button on the support toolbar. I'm using it inside an ActionBarActivity.
mewa
  • 1,532
  • 1
  • 12
  • 20
43
votes
8 answers

Add elevation/shadow on toolbar for pre-lollipop devices

I updated my android app to the new material design, but I also wanted to add some shadow or elevation to the Toolbar. There seem to be some (hacky) ways of doing it via images/9-patches, but I wonder if it can be done via the support libraries.…
avb
  • 1,558
  • 1
  • 14
  • 37
42
votes
18 answers

How to use a TabLayout with Toolbar inside CollapsingToolbarLayout?

I am looking at the chrisbanes/cheesesquare and I am trying to put TabLayout with a Toolbar inside a CollapsingToolbarLayout, and here is my code
40
votes
17 answers

Android Toolbar moves up when keyboard appears

I'm creating a chat based UI screen where I have toolbar and recyclerview for chat messages, and reply msg layout. Whenever edittext get focus It moves up the toolbar. Instead I would like to resize the recyclerview. some of the stackoverflow…
40
votes
17 answers

Change title color in toolbar?

I have a toolbar that I use, and set title with: ((ActionBarActivity)getActivity()).getSupportActionBar().setTitle("Home"); Is there a way to change the color from black to white? I tried making its own theme and setting it in the xml like this,…
Mike
  • 6,751
  • 23
  • 75
  • 132
39
votes
5 answers

How to hide ToolBar when I scrolling content up?

I am trying to hide my tool bar when I scroll my text and image with content. Here I use scrollView for getting scroll content. When I scroll content up, how to hide the tool bar? Here is my XMl…
39
votes
10 answers

How to replace the hamburger icon used for ActionBarToggle on Android Toolbar with a custom drawable?

I have implemented a basic ActionBarDrawerToggle using the new Toolbar in Android 5.0. However, I am unable to figure out how to change the default hamburger icon that is supplied. From the android documentation it says that "the given Activity will…
jet
  • 415
  • 1
  • 4
  • 8
37
votes
13 answers

Error: Unable to resolve module `@react-native-community/toolbar-android`

Weirdly, the react-native-vector-icons was working well but by using ^ ("^6.6.0") for its version in the package.json file on the new release this error happens. It's weird because two days ago it works well but now starting of my project ran to…
37
votes
6 answers

Prevent CollapsingToolbarLayout collapse if not needed

Using: compile 'com.android.support:design:23.0.0' compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.android.support:cardview-v7:23.0.0' compile 'com.android.support:recyclerview-v7:23.0.0' With the project Cheesesquare updated. Into…
35
votes
3 answers

Scroll behavior in nested RecyclerView with horizontal scroll

I have to create vertical RecyclerView with nested horizontal RecyclerView in every item. Everything is within CoordinatorLayout. When I scroll by tapping outside nested RecyclerView toolbar hides, but when I scroll parent Recycler by tapping on…
35
votes
10 answers

android title won't show in toolbar

I have an xml that I use with so many activities with fragments file but my problem is that I can't display the text I want in the toolbar, I use that xml that way because I have a navigation drawer and I needed to handle somethings so I had to do…
35
votes
5 answers

Fragment overlaps the AppCompat toolbar

I'm working with the v7 support library and trying to have a navigation drawer on the left. As read elsewhere I set up: DrawerTest.java: The main activity that holds the drawer, into which I load my Toolbar with setSupportActionBar(), from a custom…
natario
  • 24,954
  • 17
  • 88
  • 158
35
votes
2 answers

Video player lights out mode in Android using appcompat-v7

I'm porting a codebase from native Holo (Theme.Holo etc) to the appcompat-v7 (Theme.AppCompat and so on). The last section contains the tl;dr if you don't want to read the details. The issue Everything's working but I had issues replicating one…