android-toolbar

toolbar menu item click in fragments

▼魔方 西西 提交于 2019-11-30 18:37:13
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, I have added a single share button. I am getting the click event callback for the Up navigation (arrow home button) but I am not getting click event callback for the share button in my fragment. Can some points me at what I am doing wrong here. menu.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:/

Tint Navigation Icon in Toolbar

*爱你&永不变心* 提交于 2019-11-30 18:31:59
How to tint menu icons is already covered a few times, like here: Toolbar icon tinting on Android Additionally to this solution there is still the problem of the navigation icon. Applying a Theme(Overlay) to your Toolbar just tints the text and the whitelisted icons (see: https://stackoverflow.com/a/26817918/2417724 ) If you set a custom icon (which happens to be quite easy the case, as you need to change it if you don't want to display the default back arrow) then this custom icon does not get tinted. How do you handle your Icons then? All my icons are per default black and I don't want to

Gmail tablet like Actionbar items

为君一笑 提交于 2019-11-30 17:56:19
I'm trying to build an app with a split actionbar/toolbar like in the Gmail app. Is there any view element for this behaviour or do I have to write such a toolbar myself? The search icon is moving with the master fragment when opening the slidingDrawer . To accomplish this you can add one of the new Toolbar widgets to each of your fragments layouts. The new Toolbar class was designed to be much more flexible than a traditional Actionbar and will work well in this split design. This post is a good overview for implementing a standalone Toolbar. For posterity's sake I've included the sample code

Elevation on AppBarLayout doesn't work

走远了吗. 提交于 2019-11-30 17:55:14
问题 When I try to set a specific value to elevation for AppBarLayout, the shadow disappears completely. <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:elevation="4dp"> <!-- Toolbar --> <android.support.v7.widget.Toolbar... <!-- Other Layouts --> </android.support.design.widget.AppBarLayout> Is this a bug or the expected behaviour? I'm using the version 26.0.0 of the design library. 回答1: Setting Property Animation Creating

Android Material with Extended Toolbar

£可爱£侵袭症+ 提交于 2019-11-30 17:53:48
问题 I'm testing material design and i'm developing an app using extended toolbar. My app is very simple: The main activity extends ActionBarActivity and my layout looks like: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".WeatherActivity" android:orientation="vertical"> <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android

How to change all ToolBar's icons color dynamically without styling toolbar

老子叫甜甜 提交于 2019-11-30 16:00:39
问题 I have been looking a way to change the color of all elements in a toolbar working like an ActionBar dynamically. Specifications: Using parent="Theme.AppCompat.Light.NoActionBar" on styles.xml Appcompat v7 22 setting setSupportActionBar() in my AppCompatActivity I got the colors from a POST request (usually #FF------ format) I have read following post: How do I change the color of the ActionBar hamburger icon? How to change color of hamburger icon in material design navigation drawer Can't

How to change all ToolBar's icons color dynamically without styling toolbar

我与影子孤独终老i 提交于 2019-11-30 15:43:12
I have been looking a way to change the color of all elements in a toolbar working like an ActionBar dynamically. Specifications: Using parent="Theme.AppCompat.Light.NoActionBar" on styles.xml Appcompat v7 22 setting setSupportActionBar() in my AppCompatActivity I got the colors from a POST request (usually #FF------ format) I have read following post: How do I change the color of the ActionBar hamburger icon? How to change color of hamburger icon in material design navigation drawer Can't change navigation drawer icon color in android ActionBarDrawerToggle v7 arrow color Android Toolbar color

Disabling navigation drawer from fragment

拜拜、爱过 提交于 2019-11-30 12:56:22
I have an app with a navigation drawer and 4 navigation items (Fragments). In one of the Fragments, I have a tab layout set up with a view pager (3 more Fragments). From one of these inner fragments, I want to disable/enable the navigation drawer dynamically. Basically, on a button press, I want to restrict access to the navigation drawer (and the re-enable on pressing it again). How would I do it? I tried accessing the DrawerLayout of the parent activity from this inner fragment. But I see no methods to enable/disable the navigation drawer. The way I've added the drawer to my main Activity:

Is there an official API for centered title on Toolbar like on popular Android apps, in the new material design?

半城伤御伤魂 提交于 2019-11-30 12:51:21
Background In the past, Google always shown the toolbar to have the title aligned to the left: https://material.io/develop/android/components/app-bar-layout/ However, recently, it seems that on some of its apps, the title is centered, even if it doesn't have symmetric content on the left and right. Example is on "Messages" app : And on "Google News" app : It also got updated on the material guidelines, here . Example: Some people like to call it "material design 2.0", as it got various things updated. The problem While there are plenty of similar questions on StackOverflow from the time it was

Android Support Toolbar colorControlNormal color

纵饮孤独 提交于 2019-11-30 12:49:35
问题 I would like to set my spinner drop down color to white, whilst keeping the other elements in my theme the default color. Here is the situation: <android.support.v7.widget.Toolbar android:layout_height="@dimen/action_bar_height" android:layout_width="match_parent" android:minHeight="?attr/actionBarSize" android:background="?attr/colorPrimary" app:theme="@style/ToolbarTheme.Base" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> <Spinner android:layout_width="wrap_content" android:layout