android-toolbar

AppCompat ToolBar popupTheme not used when multi selection active

老子叫甜甜 提交于 2019-12-08 04:28:14
问题 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 toolbar). I have no idea why that is since it has the right color if the multi-selection isn't active. Any ideas

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

痞子三分冷 提交于 2019-12-08 02:27:27
问题 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

getSupportActionBar() NullPointerException

青春壹個敷衍的年華 提交于 2019-12-07 21:52:30
问题 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? 回答1: The IDE warns you about a potential NullPointerException because there are many cases where the app could throw one. For

How to fully mimic Action item view in the toolbar, for a customized one?

情到浓时终转凉″ 提交于 2019-12-07 13:44:42
问题 Background I have an action item that's not quite standard. It has its own layout, because I've failed to create a nice Drawable for it (written about it here). Basically, it's just a TextView with a background that wraps its short text that it shows. The problem Sadly I can't find a way of fully mimic it to look like normal ones: The ripple effect (and probably the simple clicking effect on older versions too) doesn't have the same color and size. There isn't a toast for when I long click on

AppCompat ToolBar popupTheme not used when multi selection active

醉酒当歌 提交于 2019-12-07 12:45:28
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 toolbar). I have no idea why that is since it has the right color if the multi-selection isn't active. Any ideas what I am doing wrong? Styling of the toolbar: <style name="PostToolbarStyle" parent="android:Theme

How to Control Menu Position in Toolbar Android

℡╲_俬逩灬. 提交于 2019-12-07 09:50:30
I want to change the gravity of my inflated menu item in android xml code but i could not find any attribute to solve the problem. i want an item in the left side and another item in right side of corner in Toolbar . Do you have any idea guys? Here's my present state: Here's my menu xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/dismis" android:icon="@drawable/close" android:title="Done" app:showAsAction="always"></item> <item android:id="@+id/saveNote"

How to add item number on the cart icon at top toolbar? Android

依然范特西╮ 提交于 2019-12-07 08:12:27
问题 I saw some apps made it. So I am intersting at how to do it. I believe there must be some trick way to do it. Example: I add the cart icon in the menu file. ` <item android:id="@+id/action_drawer_search" android:orderInCategory="300" android:title="Search" android:icon="@drawable/ic_search_white_24dp" app:showAsAction="ifRoom" /> <item android:id="@+id/action_drawer_cart" android:orderInCategory="200" android:title="Cart" android:icon="@drawable/ic_shopping_cart_white_24dp" app:showAsAction=

Custom layout in Toolbar with TabLayout below

可紊 提交于 2019-12-07 07:31:07
问题 Right now, I have a normal looking Toolbar . What I want to do is add a custom layout between the Toolbar and the TabLayout , as shown in the picture below: On the left is what my Toolbar looks like now, and on the right is what I want it to look like. As you can see, I want to add an ImageView and two TextView s to the layout. How can I achieve this? Here is my current layout: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http:/

setting minHeight in CollapsingToolbarLayout not having any effect

馋奶兔 提交于 2019-12-07 03:22:45
问题 The main problem I've currently got with the CollapsingToolbarLayout is, that whatever I'm trying, the minHeight attribute of my Toolbar does not have any effect. My desired result would be this: (The CollapsingToolbarLayout with a certain expanded height and a certain collapsed height (in the example 180dp), while the title either collapses or stays on the top) But whatever I do, the title sometimes is in the center, won't completely collapse or the minHeight is ignored anyway. I have tried

Soft Keyboard Hides Toolbar

半腔热情 提交于 2019-12-07 02:45:03
问题 I have used Toolbar in my layout. Whenever I open the activity, and focus on the edit-text, it hides the toolbar. Please see below pictures Below is my layout file: <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" android:orientation="vertical" tools:context="com.example.sampleactivity"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar"