android-toolbar

AppBarLayout elevation hides toolbar

大城市里の小女人 提交于 2019-12-07 02:05:34
问题 I'm trying to disable the shadow below a transparent AppBarLayout/Toolbar. Here's the layout: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="#000"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows=

Toolbar not hiding on RecyclerView scroll

只谈情不闲聊 提交于 2019-12-07 00:07:49
问题 I'm trying to make the Toolbar in my app hide and show based on the RecyclerView 's scrolling. This gif shows what I'm trying to achieve. I'm following this tutorial and not getting the results I'm looking for. Here is my activity's layout: <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/coordinatorLayout" android:layout_width="match_parent" android:layout_height=

How to have an image with a dynamic text in it, all in a drawable, like the “today” action item on Google Calendar app?

早过忘川 提交于 2019-12-06 19:59:42
问题 Background Google Calendar app has an action item that dynamically change according to the current day ("today"): I'm required to do a very similar thing, but with a slightly different image that surrounds the text. The problem I did succeed to make it work, by creating a Drawable that has text and image in it (based on here). However, I'm don't think I did it well enough : Text font might be different across devices, so might not fit well in what I wrote. Not sure if it's because of the

android toolbar: how to have a toolbar with image in the background and menu items on top

与世无争的帅哥 提交于 2019-12-06 19:28:59
问题 Using material design how to create a toolbar with background image. the following is what i want: I am trying the following code: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/actionBar" android:layout_width="match_parent" android:layout_height="200dp" app:contentInsetEnd="0dp" app:contentInsetStart="0dp" android:minHeight="200dp">

How to make SearchView that covers the entire ActionBar/Toolbar

喜欢而已 提交于 2019-12-06 12:31:36
问题 How does one create this? If you try using a Toolbar and you have inflated MenuItems you'll quickly find out that your Toolbar layout will shrink in width so it does not overlay the MenuItems. The only thing that comes to mind is inflating a layout and adding it to the Window as an overlay that sits on top of the ActionBar. Remember, this is not a problem if you do not need to inflate MenuItems in your Toolbar/ActionBar as then you are given the full width to occupy. 回答1: So I went with the

Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in onPostCreate work?

别来无恙 提交于 2019-12-06 10:24:21
I have refined the Navigation Drawer Activity project template of Android Studio, which uses Toolbar , v7.app.ActionBarDrawerToggle and NavigationView instead of the NavigationDrawerFragment (and layout/fragment_navigation_drawer.xml). According to Google's guidance and reference , I set up ActionBarDrawerToggle. I made it 1) instantiate in onCreate, 2) call syncState in onPostCreate and 3) call through to onConfigurationChanged and onOptionsItemSelected. It is almost perfectly working except for one thing: the hamburger icon is showed as an arrow . A similar issue can be found on the

Toolbar title is not centered

吃可爱长大的小学妹 提交于 2019-12-06 10:07:40
问题 I added a Toolbar in my app. For that I am using the below xml code for custom toolbar layout. Toolbar.xml <?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="wrap_content" android:background="#212E42" android:minHeight="?attr/actionBarSize"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"

getSupportActionBar() NullPointerException

怎甘沉沦 提交于 2019-12-06 05:10:35
In onCreate() method of activity I have this code for ToolBar : toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); My IDE warms me that getSupportActionBar().setDisplayHomeAsUpEnabled(true); may produce NullPointerException . My question is should I ignore it and how can I fix it anyway? The IDE warns you about a potential NullPointerException because there are many cases where the app could throw one. For the example you could be using a NoActionBar theme for your whole Application (or just for the concerned

Push icons away when expandig searchview in android toolbar

﹥>﹥吖頭↗ 提交于 2019-12-06 03:57:40
问题 I'm facing this particular behaviour and I don't know how to fix it.. In my activity I have this toolbar: And when you click on the search icon it expands and pushes the other icon to out of the view. I want to know how could I keep the icon on the right and reduce the search view space. This is my menu layout: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_search" android:title="@string

Android toolbar show title and subtitle only when AppBarLayout collepsed

夙愿已清 提交于 2019-12-06 03:33:31
问题 I have activity with AppBarLayout ,CollapsingToolbarLayout and toolbar. Setting title and subtitle from code. Initially i want toolbar hidden and show when Appbar layout collapsed, With my code its working (toolbar hide initially) but its showing toolbar title and subtitle always. How do i show title only when appbar layout collapse completely <android.support.design.widget.AppBarLayout android:id="@+id/app_bar" android:layout_width="match_parent" android:layout_height="@dimen/app_bar_height"