android-toolbar

Toolbar button gravity for extended toolbar

拥有回忆 提交于 2019-12-03 08:42:24
Im trying to set the position of my back navigation icon in my extended toolbar as follows: <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" app:theme="@style/Toolbar" android:minHeight="@dimen/action_bar_height" app:buttonGravity="top" android:gravity="top" android:background="?attr/colorPrimary" /> Checking the sources of toolbar we can see the following: private void ensureNavButtonView() { if

How to put RecyclerView below Toolbar and above TabLayout and ViewPager also handling responses to scrolls in a custom manner?

◇◆丶佛笑我妖孽 提交于 2019-12-03 08:02:10
问题 I want to create a layout like the below image: A CoordinatorLayout which contain : CollapsingToolbarLayout( contain ImageView & Toolbar) RecyclerView TabLayout ViewPager( that each fragment of it contain a RecyclerView) I wanna responding to scroll events in this way: CollapsingToolbarLayout expand and collapse by scrolling Toolbar sticks to the top until TabLayout reach to the top After that toolbar scroll up and TabLayout stick to the top I'm having trouble with the RecyclerView between

Toolbar is hidden in nested PreferenceScreen

蓝咒 提交于 2019-12-03 07:58:37
问题 I use PreferenceFragment in ActionBarActivity from support-v7 library. In the Activity I have Toolbar . Everything goes okay, until I open a nested PreferenceScreen . In the opened screen the Toolbar is hidden. Maybe somebody know a workaround for this issue? Preferences xml-file: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <PreferenceCategory android:title="Main category" > <EditTextPreference android:defaultValue=

Android Lollipop Toolbar vs Custom view

本秂侑毒 提交于 2019-12-03 07:58:34
问题 I just read about the new Toolbar in Android Lollipop. It inherits from ViewGroup. Why are the advantages of using the new Toolbar over, say, a LinearLayout to place your own views? 回答1: Explanation: You should start using a ToolBar instead of the ActionBar . This is directly taken from the Android Developer documentation. It allows more flexibility than the normal ActionBar ; however, retains some the more prominent features such as adding a Logo , supports "up" Navigation , inflating menus

AppCompat v21 Dark ToolBar style

社会主义新天地 提交于 2019-12-03 07:46:03
问题 I want my ToolBar to serve as an ActionBar and I want it to look like a light theme with a dark action bar. I can't seem to find the right combination to do it. This is what I have in styles.xml <style name="Theme.MyTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="windowActionBar">false</item> <item name="colorPrimary">@color/my_awesome_color</item> <item name="android:textColorPrimary">@color/my_awesome_text_color</item> <item name="colorPrimaryDark">@color/my_awesome_darker

Toolbar title not in center when Back Button is enable

為{幸葍}努か 提交于 2019-12-03 07:24:22
问题 I'm trying to display my toolbar title in the center and to do it I use the method which is given in this answer :-Toolbar Center title However, when I enable back button in my activity by following code: toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mActionBar = getSupportActionBar(); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setDisplayShowHomeEnabled(true); The title of toolbar doesn't show up in the center but slightly off-centered towards the

How to add a spinner next to a menu in the toolbar

依然范特西╮ 提交于 2019-12-03 07:19:33
I want my spinner to be next to my menu in the toolbar (to the left of the menu), but currently the spinner appear below the menu. Do i have to add it somehow inside the onCreateOptionsMenu(Menu menu) My Activity: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); Spinner spinner = (Spinner) findViewById(R.id.travelType_spinner); // Create an ArrayAdapter using the string

Set menu item background color on hover in Android

冷暖自知 提交于 2019-12-03 06:43:14
I have menu items in my app, and I would like to change color of item background, when it is clicked (please see screenshot - item 1 is clicked) I just want one color here - either light blue, or dark one. However, as you can see, there are two of them on the first item. Here is my code: Toolbar in activity: <android.support.v7.widget.Toolbar xmlns:sothree="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_toolbar" sothree:theme="@style/MyActionBar" android:layout_alignParentTop="true" style="@style/toolbarButton"> ... <

Change TextColor in SearchView using Android Toolbar

不打扰是莪最后的温柔 提交于 2019-12-03 05:57:07
I have the following problem. I've setup my Actionbar to use a Toolbar instead using the API 21 with the appcompat-v7:21. The textColorPrimary style tag is configured to use the color @android:color/white , so all the titles in the new Android Toolbar will have a white text color (so far so good). Now I´ve added a SearchView, and setup a custom background to it like this: <style name="AppTheme.Base" parent="Theme.AppCompat.Light"> <item name="colorPrimary">@color/action_bar_background</item> <item name="colorPrimaryDark">@color/status_background</item> <item name="android:windowNoTitle">true<

Android Toolbar style

杀马特。学长 韩版系。学妹 提交于 2019-12-03 05:41:35
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. You can add TextView inside Toolbar, for example : <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/re/android" xmlns