FAQ Database Discussion Community


Change toolbar like gmail Android?

android,recyclerview,android-toolbar
Gmail shows us an feature that it changes the toolbar color and button , and also highlight the recycleView when we click on the circle. Is there anyway I can implement this feature? To make thing clear, I have added 2 images to show what I meant(notice on the 3rd...

How is a persistent toolbar in android best implemented?

android,android-toolbar
In the Google Music App, when a song is played, a tool bar at the bottom of the screen appears with media information and controls. I want this same functionality. Currently, I am using a toolbar. <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/primaryColor" android:id="@+id/tbMedia" android:layout_alignParentBottom="true"> </android.support.v7.widget.Toolbar> It is displayed when audio...

How could I set up an app.compat actionbar toolbar without extending actionbaractivity?

android,android-actionbar,android-toolbar
I am already extending another class (expandablelistactivity) but I need a toolbar in my activity. Is there a way around this? Usually I use toolbar in combination with: setSupportActionbar() in my activity. And in the xml for my activity, I'll use: <android.support.v7.widget.Toolbar/> And in my apptheme, I'll set it to...

Set ActionBarDrawerToggle in center of toolbar or actionbar, android?

android,toolbar,android-toolbar,actionbardrawertoggle
I have created my activity XML through java and also put the navigation drawer. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDrawerLayout = new DrawerLayout(getApplicationContext()); mDrawerLayout.setLayoutParams(new DrawerLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); content_frame = new FrameLayout(getApplicationContext()); content_frame.setLayoutParams(new FrameLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); content_layout =...

Android Toolbar instead of action bar

android,android-actionbar,android-toolbar
I'm trying to use Toolbar instead of ActionBar. In Android 5.0.+ it works but in 4.4 the status bar is placed on top of the Toolbar. Screenshot: Layout: <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"...

trying to implement toolbar in android

android,android-styles,android-toolbar
I am trying to get rid of my actiobars and use toolbar to update my app. I am not making my apps for 5.0 yet, so no other material goodness. From following another post I made my themes.xml look like this: <style name="AppTheme.Base" parent="Theme.AppCompat"> <item name="colorPrimary">@color/mycolorprimary</item> <item name="colorPrimaryDark">@color/mycolorprimarydark</item> <item name="android:windowNoTitle">true</item>...

Adding toolbar to activity causes NoClassDefFoundError

android,android-actionbar,android-support-library,android-toolbar,android-actionbaractivity
I'm Trying to add a toolbar to an activity. But I'm getting this error: java.lang.NoClassDefFoundError: android.support.v7.app.ActionBarActivityDelegateBase$2 at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:304) at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:225) at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102) at...

Android ActionBar or Toolbar

android,android-studio,android-actionbar,navigation-drawer,android-toolbar
I've been reading/youtubing a lot about how I should start my next app and found out that the activities suggested as start activities in Android Studio may contain deprecated elements such as the ActionBar, and that I should rather start from scratch without an activity, and use the newly lollipop-introduced...

Android Design Support TabLayout overlapping content

android,layout,tabs,android-toolbar,androiddesignsupport
I am using the new TabLayout introduced in the design support library. I have the code like this: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent"> <android.support.design.widget.CoordinatorLayout android:id="@+id/lines_coordinator" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent"...

Android Support Toolbar Styling

android,appcompat,android-toolbar
I am trying to implement a Light Theme of AppCompat with a dark toolbar (action bar), however when adding the toolbar dynamically or using <include /> the text fails to display in the correct color (black instead of white). The default action bar is styled correctly, but when I add...

Android toolbar filling entire screen

android,android-5.0-lollipop,appcompat,android-toolbar
So I am attempting to implement a navigation drawer using the appcompat library. I am using a toolbar as my action bar. My issue is that my toolbar is filling the entire screen. This being the problem Here is my toolbar. <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/toolbar" android:minHeight="?attr/actionBarSize" android:background="?attr/colorPrimary"...

Android Crash on start: Styling the ActionBar Theme App.Compat

java,android,appcompat,android-toolbar
I don't want to post since it seems simple. For the sake of simplicity I'll provide as much detail as I can without throwing up a bunch of logcat and expecting a cure all. Following the google tutorial for styling an action bar. Win7, Android Studio, Android 5, API 19...

Android Toolbar Popup menu not showing icons

android,android-menu,android-toolbar
I am trying to show a drop down menu for my toolbar which includes BOTH text and icons: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/menu_add" android:title="@string/menu.add" android:icon="@drawable/ic_add_black_24dp" app:showAsAction="always" /> <item android:id="@+id/menu_edit" android:title="@string/menu.edit" android:icon="@drawable/ic_create_black_24dp" app:showAsAction="never" /> </menu> The menu_add does...

Toolbar button gravity for extended toolbar

android,android-layout,android-support-library,android-toolbar
Im trying to set the position of my back navigation icon in my extended toolbar as follows: <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" app:theme="@style/Toolbar" android:minHeight="@dimen/action_bar_height" app:buttonGravity="top" android:gravity="top" android:background="?attr/colorPrimary" /> Checking the sources of...

Toolbar without icon, but with title

android,android-actionbar,android-toolbar
I want to have a Toolbar without icon (AND WITHOUD EMPTY SPACE BETWEEN LEFT BORDER AND TITLE), but with title like on screen below: Tried different combinations of ActionBar/Toolbar methods, but can't achieve this. What i get is: Is there any way to achieve what is on 1st screen without...

Use Toolbar across all activities (Android)

android,toolbar,android-toolbar
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 activity....

Designing Toolbar and using Floating Action Buttons

android,android-animation,material-design,android-toolbar,floating-action-button
Although there is some information on the Internet on more or less how the extended Toolbar works and how you are meant to add different Views to it, I would like to have a step-by-step guide for me and everyone else who wants to implement the extended Toolbar into their...

Android Toolbar has more padding than ActionBar, how to fix

android,android-actionbar,material-design,android-toolbar
I had to replace the actionbar to implement new UI patterns the design team wanted The actionbar is now replaced with the ToolBar but the toolbar object is bigger than the actionbar, only marginably, but it is noticeable and not desired Here is the XML declaration <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar...

How to add DrawerLayout to my ToolBar / ActionBar

android,navigation-drawer,android-toolbar
I have a custom Toolbar that I've set up in my MainActivity to be the top action bar. The question is, how do you implement a NavigationDrawer to display when the ImageView in the toolbar is clicked? In MainActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_main_drawer); Toolbar mToolbar =...

Android add icon in toolbar inside a fragment

android,android-actionbar-compat,android-toolbar
I implement a toolbar and replace it with my actionbar according to my requirments. Now I want to add an icon in toolbar inside a fragment. I tried onCreateOptionMenu() and pass my menu xml to it. But it wont work. I also tried some other things and googling but nothing...

Touch feedback on menu item with actionLayout

android,android-5.0-lollipop,android-menu,android-toolbar
I'm using a menu item with actionLayout because I need to add a textView along with my icon for the item on the ActionBar. everything shows up correctly but I don't know (and couldn't find anywhere) how to add the animation that shows up when user taps on a menu...

How add a single menu item left to the toolbar in android?

android,toolbar,menuitem,android-toolbar,android-actionbaractivity
I simply want a back button in left side of toolbar.But when i added with following code ,appear in right side of toolbar.how can i change to it to left side? my code <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.me.myapp.activities.Timer"> <item android:id="@+id/backButton" android:title="Back Button" android:icon="@mipmap/back_icon" app:showAsAction="ifRoom"></item> </menu> ...

Overlap home button using Toolbar

android,android-toolbar
I'm using the (relatively) new Toolbar widget instead of an ActionBar. I'm trying to overlap the home menu button (burger) with a notification icon. I've tried a few hacky things to get this done but nothing has worked. Has anyone faced a similar situation? Thanks!...

Search in Toolbar is force closing my app

android,android-fragments,android-toolbar,android-search
I have my main actionbaractivity MainDrawer2: public class MainDrawer2 extends ActionBarActivity { private static final String EXTRA_NAV_ITEM = "extraNavItem"; private static final String STATE_CURRENT_NAV = "stateCurrentNav"; private ActionBarDrawerToggle mDrawerToggle; private DrawerLayout mDrawerLayout; private NavDrawerListAdapter mDrawerAdapter; private ListView mDrawerList; private CharSequence mTitle; private CharSequence mDrawerTitle; private MainNavItem mCurrentNavItem; public static Intent...

CollapsingToolbarLayout not working(collapsing)when scrolled

android,material-design,android-toolbar,androiddesignsupport,collapsingtoolbarlayout
I am trying to create a CollapsingToolbarLayout and below it a listview, when the listview is scrolled the Toolbar should collapse, but its not working when scrolled the Toolbar is not collapsing. Used this tutorial: http://android-developers.blogspot.in/2015_05_01_archive.html Note: The FrameLayout contains the listview <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content"...

Seeing message in logs: “app:theme is deprecated”?

android,appcompat,android-toolbar
Ever since upgrading to the latest appcompat library, I'm seeing a message in my logs from ViewUtils. app:theme is now deprecated. Please move to using android:theme instead. I'm using parent="Theme.AppCompat.Light.NoActionBar" as my theme parent....

How could change style theme of actionbar in contextual menu mode

android,android-toolbar,appcompatactivity
I am using toolbar with following style, <style name="Toolbar" parent="Theme.AppCompat"> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primaryDark</item> <item name="colorAccent">@color/accent</item> </style> Style theme of Activity (AppCompatActivity) is <style name="AppTheme.Toolbar" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/primary</item> <item...

Run search intent on current activity

android,searchview,android-toolbar
I want to achieve a text search on my WebView which is located on AboutActivity. The problem is that when I run the query, secondary activity takes place.. I want my AboutActivity to stay as it is and not SearchableActivity take its place. Here is my code which is implemented...

Android v7 Toolbar button alignment

android,android-layout,android-actionbar,android-actionbar-compat,android-toolbar
I added android.support.v7.widget.Toolbar in my app using below code, now I want to show a button in the right end of the toolbar, but not able to do so. <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/accent_color" android:minHeight="?attr/actionBarSize" android:layout_alignParentTop="true"...

Android Toolbar not working [duplicate]

android,android-actionbar,material-design,android-toolbar
This question already has an answer here: Upgraded to AppCompat v22.1.0 and now getting IllegalArgumentException: AppCompat does not support the current theme features 2 answers I am trying to make a backwards compatible toolbar in Android, and I followed all the suggestions given in multiple style guides to try...

Problems with Home button in the Toolbar

android,android-studio,android-actionbar,toolbar,android-toolbar
I know it's a common question but I tried a lot of solutions of StackOverflow and any solution works. I want to show the home button in the toolbar but it shows the back button or nothing. I tried different codes like: getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true); Now I have the...

Android Toolbar menu button click event

android,android-toolbar
I have a simple Toolbar in my fragment. The Toolbar has a menu associated to it (overflow menu under the 3 dots icon) and everything works pretty well - I get my click events when one of the menu items is selected. However, I need to do something when the...

Android toolbar context menu for listview items

android,android-listview,menu,contextmenu,android-toolbar
I am looking for help on how to implement a context menu in the toolbar for ListView items, like WhatsApp does it. The only tutorials I found so far are about a dialog that pops up, which is not what I want. Can someone help me or provide links with...

Why is the Toolbar in the middle of the screen?

android,appcompat,android-toolbar
I am trying to use the toolbar using the Android Developers Guide for enabling material theming on pre-lollipop devices. My app theme extends Theme.AppCompat.Light.NoActionBar as so: <style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar"> and windowActionBar is set to false as so: <style name="AppTheme" parent="AppBaseTheme"> <item name="colorPrimary">#EEEEEE</item> <item name="windowActionBar">false</item> </style> My MainActivity looks like this:...

Back navigation with Fragments / Toolbar

android,fragment,android-toolbar,android-actionbaractivity,fragment-backstack
I'm scratching my head with this one now.... I have an ActionBarActivity that loads an initial Fragment - the original menu is inflated within the activity. Now, I have a navigation bar that, when an item is selected, loads a different fragment and adds this to the backstack. When I...

How to dynamically change from Hamburger icon to Up icon in Appcompat 22

android,android-support-library,android-toolbar,appcompat-v7-r22.1
I would like to change a Hamburger icon in ToolBar to Up icon ("<") given a user input within a same Activity. This is my ToolBar: <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:minHeight="?attr/actionBarSize" app:titleTextAppearance="@style/ToolbarTitle"> on MainActivity#onCreate Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar); }...

Android toolbar not doing what I want

android,android-toolbar
I have a nearly full screen dialog fragment in my app, containing a toolbar on top. I want to style this toolbar like in the Material design guidelines: Toolbar XML: <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_height="@dimen/abc_action_bar_default_height_material" android:layout_width="match_parent" android:title="@string/new_folder" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" android:background="@color/primary_dark"/> menu XML:...

Change title color in toolbar?

android,android-theme,android-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, but no dice: <resources> <!-- Base application theme. --> <style name="AppTheme2" parent="Theme.AppCompat">...

Contextual Toolbar action mode is with background white on API 16/19

android,android-actionbar,android-toolbar
I'm using API 22 as target and min API 16. Using android.support.v7.app.ActionBarActivity and a Toolbar. On target (API 22) the contextual toolbar works normal, showing the actions buttons, etc. But testing on API 16 and API 19 the contextual action bar is getting the background as WHITE (maybe default) but...

Navigation drawer on lollipop is empty after adding Toolbar

android,navigation-drawer,android-toolbar
I had a navigation drawer working a while back, but then I decided to update it to use a Toolbar instead of the default support action bar. Now, I have a situation where when I click the hamburger menu, the navigation drawer doesn't open. However, I can slide from left...

Change Toolbar Menu Item color (non-hidden action)

android,android-toolbar
Say I have a menu (options_menu.xml) similar to the following: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_login" android:title="Login" app:showAsAction="always"/> </menu> which I inflate into the new Toolbar item mToolbar.inflateMenu(R.menu.options_home); This results in something like Is there a way to change this text color without using an image, changing the rest of...

Toolbar not visible in layout

android,android-toolbar
Below is my layout, and when running the toolbar is not visible at all, the two tabs on the tabview take up the entire screen. In the preview in AndroidStudio I do see the ActionBar as I expect it to be at the top. What am I missing? <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"...

Toolbar+SearchView+textSelection = bad position of text selection bar

android,android-support-library,searchview,android-toolbar,textselection
Background I'm trying to theme my app to have more material design look, and as such, I have a toolbar that's being set as the actionBar of the activity. I have a SearchView in it that allows to search items of the listView below. The problem Thing is, you can...

Tool bar setNavigationOnClickListener breaks ActionbarDrawerToggle functionality

android,android-toolbar,android-navigation
I'm swapping out the action bar for the tool bar, and I nearly have every piece of the puzzle in place. My issue is specifically if I navigate 'up' and restore the navigation drawer, the drawer toggle button no longer works. I figured out if I set the drawer mode...

Android Toolbar Action button height

android,android-layout,appcompat,android-toolbar
I have res/layout/toolbar.xml which is: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?actionBarSize" android:elevation="4dp" style="@style/ToolbarStyle"> </android.support.v7.widget.Toolbar> Here is my usage of toolbar: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"...

toolbar not showing up

android,android-layout,android-actionbar,android-toolbar
I am trying to implement Android toolbar. Right now when I open my app it looks like this: The tabs in the above are not from the toolbar. Its an older version of tabs from android...I am in the process of updating.... So far, the action bar did not show...

OnClickListener not firing when Toolbar GONE

android,toolbar,android-toolbar
I have an activity containing a Toolbar and a Fragment containing a GridView. Here is the layout of the Activity : <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- The main content view --> <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent"/> <android.support.v7.widget.Toolbar android:id="@+id/home_toolbar"...

AppCompat ToolBar popupTheme not used when multi selection active

android,android-layout,appcompat,android-toolbar
In styles.xml I'm styling the popup theme of the overflow menu in the toolbar: <style name="ToolbarOverflowMenuStyle" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:backgroundTint">@color/white</item> </style> That works as intended but if I do a multi selection in a recycler view (list) the popup theme background color turns from white to yellow (the color of the...

Question mark instead of RTL field

android,material-design,android-tablelayout,android-toolbar
I used this Material Design Toolbar for my project. But I have 2 problems: When I use a RTL String for the Tabs Title, it doesn't show the String correctly private String titles[] = new String[]{"تست", "Sample Tab 2", "Sample Tab 3", "Sample Tab 4" , "Sample Tab 5", "Sample...

toolbar menu item click in fragments

android,android-toolbar
I know this question has been asked and but I am unable to solve my problem after looking at those answer. I have an Activity with a Fragment. In fragment, I have added the toolbar and I want to handle toolbar menu item click events from the fragments. In menu,...

How to implement 'View Control'?

android,android-actionbar,android-ui,android-toolbar
What is the up to date non depracated way to implement the View Control (No. 2 from the below screenshot taken from Android's design guide): I found this example but when I tried to use it I saw that commands like: actionBar.setNavigationMode() are already depracated. So how should I implement...

How to make navigation drawer toggle forcibly close all the time

android,navigation-drawer,android-toolbar,drawerlayout,actionbardrawertoggle
I am using DrawerToggle with toolbar in my project. I have a requirement to make drawer toggle in active (i.e it should not open or close on click or swipe). But I am completely struct how to achieve the things by making the toggle event standstill. I know that my...

Android transparent status bar and actionbar

android,android-actionbar,android-toolbar,appcompat-v7-r21,android-statusbar
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 answer bellow.

Using Android Toolbar

android,xamarin,android-toolbar
I'm following the following tutorial to implement the toolbar: http://blog.xamarin.com/android-tips-hello-toolbar-goodbye-action-bar/ When I write this code some things cannot be resolved. protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar); //Toolbar will now take on default Action Bar characteristics SetActionBar (toolbar); //You can now...

Showing a menu overflow button in a Toolbar

android,android-5.0-lollipop,android-toolbar
I'm just messing around with Android and trying to learn stuff by building on a dummy app. I've created a Toolbar for Lollipop, but I can't seem to figure out how to add an overflow button to the toolbar. I'm not going to be using the v7 appcompat toolbar, as...

Move Android Toolbar To Top Of Relative Layout

java,android,relativelayout,android-toolbar
Hi Guys I am trying to put my button in the center but keep my toolbar at the top at the moment both is in the middle because of the gravity center is there a way to do this without using padding attributes otherwise it will look different on other...

Layout Jitter when Toolbar hides while scrolling RecyclerView

android,scroll,android-viewpager,recyclerview,android-toolbar
Hi , I have a layout with Toolbar, PageSlidingTab and ViewPager. Inside ViewPager there is a fragment with RecyclerView. I want to hide the Toolbar as i scroll the RecyclerView. I have achieved it by adding the following code : toolbar = ((MyActivity)getActivity()).getToolbar(); mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { int toolbarMarginOffset =...

Back button in Toolbar without ActionBarActivity

android,toolbar,android-toolbar
I'm using a Toolbar inside a Fragment (which covers the whole screen) and I want to show the back button, but I can't use getSupportActionBar().setDisplayHomeAsUpEnabled(true) because I'm not using ActionBarActivity. I need something which works with API 9, so I can't use Toolbar's setNavigationIcon....

Set menu overflow icon to be white

android,android-5.0-lollipop,android-toolbar
I have a dummy app that I'm making just to get the hang of Android development. I managed to get a menu overflow icon to appear on my toolbar, but I can't seem to figure out how to change it to white. I'm using a Toolbar widget (without support libraries;...

toolbar not showing up in fragment with google maps

android,android-fragments,android-maps-v2,android-toolbar
I have an android fragment in which I bring google maps into. I am trying to add a android toolbar to the top. My xml looks like this: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:minHeight="?attr/actionBarSize" android:background="@color/primary"...

Android Contextual Action bar in adapter?

android,android-toolbar,contextual-action-bar
Im trying to implement contextual actionbar in my app. However, when I try to let the Startactionmode method in my adapter, I could not find a way to do so. I have tried : mActionMode = ((MainActivity)c).startActionMode(new MyActionModeCallback()); and it gives me an error java.lang.NullPointerException: Attempt to invoke virtual method...

Manipulating the Toolbar's title and other elements

android,android-toolbar
I'm using the AppCompat toolbar, and for the most part its great. However, dealing with the title has been a nightmare. It's set to the app name by default, and I cannot find a way to hide it. I was trying to hide it so that I can add my...

Using Toolbar with Fragments

java,android,android-fragments,android-viewpager,android-toolbar
i am trying to create a viewpager that swipes through 3 different fragments each with a different toolbar. I have implemented the new toolbar in an activity before and got it to work however i am trying to get it to work with fragments Here is the fragment code @Override...

Use Tab with new ToolBar (AppCompat v7-21) in mvvmcross

android,tabs,xamarin,android-toolbar
I have use support_v7 Toolbar as ActionBar, but i getting problem to add tabs in my activity. Is there any example to add tab with toolbar. I took a look at http://blog.ostebaronen.dk/2013/11/getting-support-v7-working-with.html

Android AppCompat Toolbar does not respond to touching action items

android,android-layout,android-support-library,android-actionbar-compat,android-toolbar
I'm following these instructions to implement an AppCompat toolbar in my Android app. I am using AppCompat version 7:22.0.1 Also, I'm using this toolbar in addition to the actionBar (it's not replacing the actionBar, as I see in many other examples). The toolbar shows up, and it even shows the...

Android toolbar + actionbar

android,android-actionbar,android-toolbar
I am using Appcompat library to get the supportActionBar in my ActionBarActivity. Now I am facing another challenge and it's how to add toolbar under that actionbar, something like facebook app has. Any ideas how to do it?

Using Sliding Tabs with Toolbar

android,android-layout,android-5.0-lollipop,android-tabs,android-toolbar
I've started to change from using ActionBarActivity to AppCompatActivity, but I've also started using the Toolbar as well instead of a standard ActionBar. However, in one of my activities which has a swiping tab type of layout, the following line seems to be deprecated: actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); Although I have looked at...

Toolbar With Ic_drawer

android,material-design,android-toolbar
I want a material drawer with ic_drawer but what happened is that I cant display my ic_drawer although navigation drawer is working perfectly I had followed this tutorial This is my output I had done something like this frameLayout= (FrameLayout)findViewById (R.id.content_frame); toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mRecyclerView =...

How to set app:layout_scrollFlags for Toolbar programmatically

android,android-fragments,android-toolbar,android-coordinatorlayout
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 each fragment but it...

Android: Toolbar Text color

android,appcompat,android-toolbar
I'm trying to use a theme in my Toolbar. I want to change the text color but I can't do it, and I don't know why. The text color is not being applied, instead of be brown it appears me with black color. Can you please help me? styles.xml <resources>...

Set toolbar title

android,android-fragments,android-toolbar
I am trying to set my toolbar title like so: public class StatisticsPage extends Fragment { public StatisticsPage(){} private FragmentTabHost mTabHost; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.statistics_pagelayout, container, false); Spinner spinner = (Spinner) rootView.findViewById(R.id.statsSpin); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.statspage, R.layout.dropdown_item);...

Toolbar bug with method setTitle

android,android-actionbar,toolbar,appcompat,android-toolbar
I am using this two methods in my toolbar: toolbar.setTitleTextColor(getResources().getColor(R.color.ColorPrimary)); getSupportActionBar().setTitle("title"); The reason for using getSupportActionBar is because toolbar.setTitle("title"); is not working. This is a bug?...

Clicking hamburger icon on Toolbar does not open Navigation Drawer

android,navigation-drawer,android-toolbar
I have a simple android.support.v7.widget.Toolbar and all I am trying to do is to open a NavigationDrawer by pressing the "hamburger" icon in the top left corner. The "hamburger" button is visible, and when I start to pull from the left I see the animation on the button but pressing...

How to use a TabLayout with Toolbar inside CollapsingToolbarLayout?

android,material-design,android-toolbar,android-design-library
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 <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.v4.view.ViewPager android:id="@+id/viewpager"...

Title, etc. not showing in Android Toolbar

android,toolbar,android-toolbar
I've just added an Android Toolbar to an app I'm working on. The toolbar placement works correctly with the toolbar layout appearing at the top of the display. However, the toolbar is showing up as a blank colored bar...the App Title and Overflow Icon do not show up in the...

CoordinatorLayout Toolbar invisible on enter until full height

android,android-toolbar,android-coordinatorlayout
Included in my activity_main.xml's DrawerLayout is a CoordinatorLayout called content_layout.xml. Within this CoordinatorLayout is my AppBarLayout containing a Toolbar, then a LinearLayout for a fragment's content. When a fragment containing a RecyclerView is scrolled up, the toolbar exits successfully. The problem lies when scrolling down to bring the toolbar back....

Android Studio: Getting the Back Key to Work in a Custom Toolbar

java,android,android-toolbar
I created a toolbar with its own XML layout file. I include the toolbar in the activity_main layout file. In the secondary activity, where the back key on the toolbar should appear, I write: getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); I also tried: getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); For both, the back arrow appears but does...

SlidingTabLayout compressing tab text

android,android-toolbar
I am using the SlidingTabLayout.java and SlidingTabStrip.java files along with the Toolbar to create swipeable tabs. I followed a couple different tutorials now and run into the same problem with how my tabs are displaying. I set setDistributeEvenly to true and changed my code to have four strings rather than...

AppCompact v21 back navigation with fragment menu

android,android-fragments,appcompat,android-menu,android-toolbar
So.. I'm facing a problem that has been driving me crazy for the past hours. I have an App using the AppCompact v21 and toolbar. I also handle back navigation using: getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); In combination with the parent activity on the manifest. Which works perfect.... My problem is: I...

How do i add Toolbar to this layout?

java,android,android-toolbar,appcompat-v7-r22.1
Layout XML: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" />...

how to add an action search icon to toolbar in android

android,android-studio,android-toolbar
Im working in Android studio 1.1 and I was trying to include a search option in my toolbar, the option search is showing in the drop dow menu and not in toolbar like an action icon. I need to put the icon search in toolbar on the right side, near...

Seekbar in toolbar that takes up remaining space

android,android-layout,android-toolbar,android-layout-weight
I am trying to create a toolbar that has text pinned to the left, text pinned to the right and a SeekBar in the middle that takes up the remaining space. I have played around with layout and have not had any luck. Here is what I have: <android.support.v7.widget.Toolbar android:id="@+id/toolbar_bottom"...

How to open android search without click?

android,searchview,android-menu,android-toolbar
I want the android searchview in toolbar open without click on search icon. Here is the XML code <item android:id="@+id/action_search" android:title="@string/search_title" app:actionViewClass="android.support.v7.widget.SearchView" app:showAsAction="always"/> And Java code in MainActivity. @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main,...

Android App with basic Material Design force closes on start

android,material-design,android-actionbar-compat,android-toolbar
I am pretty new to Android, am learning Android through some tutorials. Recently, I came across a nice website which showed a perfect implementation of Tabs usage. The link is : http://www.android4devs.com/2015/01/how-to-make-material-design-sliding-tabs.html I copy pasted the exact same code in my Android Studio. The project ZIP is attached here: https://drive.google.com/open?id=0B7Q0z2lM1VTRR3JjSXFPQk1vNkE&authuser=0...

When to set a Tool Bar as an Action Bar when using AppCompat v21?

android,android-actionbar,android-toolbar
Google introduced the Tool Bar widget in AppCompat v21. I understand that you can assign the Tool Bar as the Action Bar (via setSupportActionBar()) in your Activity. What is the advantage of installing your Tool Bar as the action bar instead of using standalone Tool Bars in your layout all...

android.support.v7 Toolbar & DrawerLayout- how to change Hamburger icon

android,android-actionbar,android-toolbar,android-navigation,android-icons
My application uses ActionBarActivity and DrawerLayout and etc. i want to change the ActionBarDrawerToggle icon to be custom drawable. in my code i use android.support.v7.widget.Toolbar as SupportActionBar this is my code: toolbar.setNavigationIcon(R.drawable.lifeline_shield); setSupportActionBar(toolbar); ActionBar actionbar = getSupportActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setDisplayShowTitleEnabled(false); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.somestring1,...

(Design Support Library) CollapsingToolbarLayout — Toolbar not getting pinned on collapse

android,android-support-library,android-toolbar,androiddesignsupport,collapsingtoolbarlayout
I'm having trouble integrating the Design Support Library into my application. For some reason, the toolbar collapses with the CollapsingToolbarLayout, and does not leave it pinned like in the Cheesesquare example by Chris Banes. https://github.com/chrisbanes/cheesesquare I didn't do anything different to my layout. In fact, I replaced my styles with...

Can't find reference to switch compat in custom layout in toolbar

android,android-actionbar,android-toolbar,switchcompat
I'm trying to add a switchcompat to the toolbar, the menu item references a custom layout toolbar_switch.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_marginRight="8dp" android:layout_height="match_parent"> <android.support.v7.widget.SwitchCompat android:layout_width="wrap_content" app:showText="false" android:id="@+id/switch_online"...

setHomeButtonEnabled on toolbar in a fragment

android,android-fragments,android-toolbar
Android studio 1.3 com.android.support:appcompat-v7:22.1.1 Hello, I am using the new toolbar and displaying in my fragment. However, I want to be able to navigate back to the previous fragment by having the setHomeButtonEnabled(true). However, in my fragment in the onCreateView there is no such function. This works in the Activity,...

Black gradient backgound on Action bar Android

android,android-actionbar,android-toolbar
I'm confused how to add the following black gradient to Action Bar. I search a lot for this, but I couldn't find the same. I have seen this gradient in many apps, moreover it's not a drawable file maybe drawable xml file. I tested by making gradient file but gave...

Toolbar's bottom border isn't displayed normally under menu item

android,android-layout,android-toolbar
I have implemented border at the bottom of toolbar. If I don't display any menu item, it looks great. The following image shows us the current look of my toolbar. I don't know any idea why border is thick under menu item. How can I solve this problem? styles.xml <style...

How to change Toolbar Navigation and Overflow Menu icons (appcompat v7)?

android,android-layout,material-design,appcompat,android-toolbar
I am having a hard time with v7 Toolbar. What was once a simple task for ActionBar, now seems overly complex. No matter what style I set, I cannot change either navigation icon (which opens a Drawer) or overflow menu icon (which opens a menu). So I have a Toolbar...

ActionBarActivity Show/Hide toolbar not working properly

android,recyclerview,android-toolbar
I am currently developing an app wherein I need the feature to hide the toolbar on scrolling down (like Google+). I am facing issues with it's rendering of toolbar on scroll. Here is how it looks now - I want the toolbar to simply hide on scroll down, but here...

How to implement the Toolbar in the default Navigation Drawer Activity?

android,android-actionbar,navigation-drawer,android-toolbar
I am using Android Studio 1.0.1. I created a new Navigation Drawer Activity that is by default provided by this IDE. It created 2 Java files - HomePage.javathat extends android.support.v7.app.AndroidBarActivity NavigationDrawerFragment that extends Fragment Along with that it provided me with 3 layout files - activity_home_page.xml fragment_home_page.xml fragment_navigation_drawer.xml Now what...

Toolbar will not collapse with Scrollview as child of CoordinatorLayout

android,toolbar,android-scrollview,android-toolbar,coordinator-layout
I am trying to follow the Google Docs on using the CoordinatorLayout but i am having an issue with the ScrollView inside the CoordinatorLayout. Basically, the Toolbar normally would collapse with a RecyclerView or a Listview when scrolling down. Now with a ScrollView it will not collapse. <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent">...

Android TabActivity with Toolbar - setSupportActionBar() unknow

android,android-tabhost,android-toolbar,android-tabactivity
Is it possible to use setSupportActionBar() in an TabActivity? Extending with AppCompatActivity is not possible... public class TabHost extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabhost); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // this is unkown getSupportActionBar().setDisplayHomeAsUpEnabled(true); //also Do I have to switch from TabActivity to FragmentTabHost? Thanks...

ActionBarDrawerToggle icon missing when using AppCompat v22

android,appcompat,android-toolbar
I'm using Appcompat v22 to use tinted style for AutoCompleteTextView. However, as soon as I changed my build.gradle from this: compile 'com.android.support:support-v4:21.0.3' compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.android.support:cardview-v7:21.0.2' compile 'com.android.support:recyclerview-v7:21.0.2' to this: compile 'com.android.support:support-v4:22.0.0' compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.android.support:gridlayout-v7:22.0.0' compile 'com.android.support:cardview-v7:22.0.0' The...

Android design library FAB no shadow

android,android-actionbar,android-toolbar,floating-action-button,androiddesignsupport
for some reason my FAB displays no shadow, even though I have set the elevation and the border width to 0, like it was described in many blogs. That should fix the issue. I am placing the fab above the toolbar to get the material design guideline look. Here is...

How to get Toolbar to overlay sibling layout (z-ordering)

android,android-layout,framelayout,android-toolbar,z-order
For the life of me, I cannot get this Toolbar to layout on top (note: not above, but on top of) its sibling LinearLayout. The only way I can get the Toolbar to overlay its sibling is by specifying the Toolbar's elevation to be > 0, but this doesn't work...

Toolbar when extending Activity

android,android-activity,android-actionbar,appcompat,android-toolbar
I need to extend Activity and not ActionBarActivity or AppCompatActivity in order to use a third party library. In all the app I've been using AppCompatActivity in order to easily add a Toolbar in it, but apparently I cannot do the same if I extend Activity. I'd be also happy...