android-toolbar

android.support.v7.widget.Toolbar icon alignment issue

守給你的承諾、 提交于 2019-12-03 05:22:19
Using the new Android 5.0 Toolbar approach, and following the Google IO example, I'm setting a navigation icon and a spinner in the toolbar. The issue is, the navigation icon is BOTTOM-aligned. I can't find any reason why this is happening... [Note that I deliberately set it to a solid square to see the alignment issue more clearly] My code is as follows: toolbar.xml <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" app:theme="@style/ActionBarThemeOverlay" app:popupTheme="@style

Use Toolbar across all activities (Android)

懵懂的女人 提交于 2019-12-03 04:46:32
问题 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. If I try to inflate the toolbar onCreateOptionsMenu, that activity will crash when I call it. How can I call/use the same toolbar across all my activities and not just the main one. here is some pieces of the code: public android.support.v7

How can I use VectorDrawable with the Android Toolbar?

不羁岁月 提交于 2019-12-03 04:33:50
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. <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item app:srcCompat="@drawable/ic_clear" app:showAsAction="ifRoom" /> </menu> I have my own toolbar layout using android.support.v7.widget.Toolbar and Android Support Library v23.2 on JB (16). Turns out it's quite easy. Say, you have vector drawable vd_trash_24dp . Describing MenuItem one cannot address VectorDrawable

CollapsingToolBarLayout - status bar scrim color doesn't change

自作多情 提交于 2019-12-03 04:33:40
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 (tried both from xml and code) initial state: started scrolling: scrolled until collapsing: So the questions are: How can I prevent the toolbar to override the status bar when collapsing (not even letting the image I'm collapsing to go above it). How can I change status bar colour after collapsing Another issue I had is that I gave the toolbar initial

Change title color in toolbar?

六月ゝ 毕业季﹏ 提交于 2019-12-03 04:12:03
问题 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"> <item name="android:windowNoTitle">true</item> <item name="windowActionBar">false</item> <item name="colorPrimary">@color/primary</item> <item

Android Toolbar and User Image Animation Like Twitter

孤人 提交于 2019-12-03 03:52:42
问题 I'm trying to achieve the toolbar and User image animation like the one that is used in Twitter's user profile. I tried a lot of things but I cannot achieve pinning the collapsed toolbar at the top of the screen quickly with the some background it had when it was expanded and making the User Image be first above the toolbar and then make a scale down and move below the toolbar while scrolling. How does twitter make the smooth effect in the User Profile image? How they first have this image in

CoordinatorLayout: Hiding/Showing half visible toolbar?

倾然丶 夕夏残阳落幕 提交于 2019-12-03 03:21:34
问题 Id like to achieve a similar effect as the one you can see in Google Play store , where by scrolling the content the Toolbar goes off-screen as you scroll. This works fine with the CoordinatorLayout (1) introduced at #io15 , however: If you stop the scroll "mid-way" the Toolbar remains on screen, but is cut in half: I want it to animate off-screen, just like in the Google Play store. How can I achieve that? 回答1: Now the Android Support Library 23.1.0 has a new scroll flag SCROLL_FLAG_SNAP

Add badge counter to hamburger navigation menu icon in Android

喜你入骨 提交于 2019-12-03 03:13:32
问题 My question is the same as this question (which is not a duplicate of this question). The only answer to that question does not work for me as, rather than changing the default hamburger icon to the left of the activity's title, it just adds an additional hamburger icon to the right of my activity's title. So how do I actually get this: I've been poking around at it all day, but have got nowhere. I see that Toolbar has a setNavigationIcon(Drawable drawable) method. Ideally, I would like to

Replace toolbar layout according to the displayed fragment

折月煮酒 提交于 2019-12-03 02:46:34
问题 I have an activity with navigation drawer which replace the main_fragment_container on the activity. When one of the fragments is displayed I want to change the layout of the toolbar and add a spinner to it (and remove it when the fragment is hidden). My layout looks like that: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:sothree="http://schemas.android.com/apk/res-auto" android:id="@+id/main_parent_view" android

Styling android search view and drop down list in actionbar

荒凉一梦 提交于 2019-12-03 02:06:01
In my app, I have a searchview that displays search suggestions. I want the dropdown/spinner and text to be a particular color. Currently the only change I've been able to make is the text color of the inputted text via the following: <style name="MyApp.AutoCompleteTextView" parent="Widget.AppCompat.Light.AutoCompleteTextView"> <item name="android:textColor">@color/white</item> <item name="android:textCursorDrawable">@null</item> <item name="android:background">@color/myBackgroundColor</item> </style> The app currently displays the searchview results like this: What I would like to know is how