android-toolbar

How to implement WhatsApp like material design SearchView?

白昼怎懂夜的黑 提交于 2019-12-03 20:22:15
WhatsApp has such Toolbar: When 'Search' menu item clicked, from the top SearchView comes down which takes whole space of toolbar: When I tried to implement SearchView, it looks like this: I found some libraries to implement this: Android Material SearchView by Eugene Horan and MaterialSearchView by krishnakapil . But they are not like in WhatsApp. This question may seem weird, I could not find the way how to do this. So my question is how to implement WhatsApp like material design SearchView which comes from the top? I have developed a well received library by the comunity. Does exactly what

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

孤人 提交于 2019-12-03 19:54:01
问题 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

How to make the Contextual ActionMode Bar overlay the appcompat-v7 Toolbar but not the navigation drawer?

我的梦境 提交于 2019-12-03 18:43:58
问题 I have an activity with an app bar and a navigation drawer. The app bar is implemented using the new Toolbar class from appcompat-v7 library version 21.+, and the navigation drawer is displayed in front of it. The activity contains a list view with items which can be selected, so I am showing a contextual action bar (CAB). It is started by calling: ActionBarActivity.startSupportActionMode(android.support.v7.view.ActionMode.Callback callback) By default, the CAB is inserted above the Toolbar

How to have a textview transition to the title in a collapsing toolbar?

寵の児 提交于 2019-12-03 17:27:53
I have a CollapsingToolbarLayout that contains a TextView and a RatingBar under the TextView . Would it be possible to have the TextView somehow transition to the title? My current layout looks like this: I want "Title" to transition up as the toolbar collapses. There will also be a back button, so how would I ensure that the textview transitions to the proper place (to the right side of the back button)? EDIT: Here is my XML <android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas

Android toolbar change layout

对着背影说爱祢 提交于 2019-12-03 16:28:18
I got an activity with many fragments. When i change fragments i need to change also and my toolbar declared in MainActivity.class . My problem is that i include a layout and didnt find a method to change this layout. How to change toolbars layout in this case? MainActivity.class @ContentView(R.layout.activity_main) public class MainActivity extends RoboActionBarActivity { @InjectView(R.id.tool_bar) Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setToolBar(); if (savedInstanceState == null) { getSupportFragmentManager()

Android Toolbar style

淺唱寂寞╮ 提交于 2019-12-03 16:23:26
问题 I've added a Toolbar to my Lollipop project. However, I'm having trouble styling the Toolbar . My title in the Toolbar appears to have a bold font, but I'd like it to be italic. Any idea how to achieve this? I've tried playing around with the actionbar-style , no luck. I've set a style on the Toolbar with app:theme="@style/toolbar" and my @style/toolbar (parent ThemeOverlay.AppCompat.ActionBar ) is where I'm playing around with no good results. 回答1: You can add TextView inside Toolbar, for

Access Toolbar (and its children) from fragment?

人盡茶涼 提交于 2019-12-03 16:10:54
I'm building an application using the v7.widget.Toolbar component. I'm able to add the toolbar to my activity, but I don't know how (and what is the right way?) to access it from the activity's fragment. Here's the toolbar <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" app:theme="@style/MainActionBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" tools

Change Toolbar color/style on SearchView click

为君一笑 提交于 2019-12-03 16:06:48
问题 I have simple question. How I can change Toolbar's color/or theme to white when clicked on Search icon? I want Toolbar to be White(with back arrow colored black/grey) whenever search icon is clicked. I have added SearcView (android.support.v7.widget.SearchView) in MenuItem This To And then back to original Toolbar color when Back button is clicked. 回答1: In Activity / Fragment code: @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater

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

不问归期 提交于 2019-12-03 15:56:05
问题 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

How can I use VectorDrawable with the Android Toolbar?

喜夏-厌秋 提交于 2019-12-03 14:45:16
问题 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). 回答1: Turns out it's quite