android-toolbar

“Back button” using getSupportActionbar and appcompat v7 toolbar

余生长醉 提交于 2019-12-02 14:14:07
I'm using the new toolbar from the Appcompat V7 library and I'm making an application with navigation drawer and with fragments. In some fragments I don't want to show the hamburger icon but the arrow instead... That is fine I did this in this way: mDrawerToggle.setDrawerIndicatorEnabled(false); mDrawerToggle.syncState(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R.drawable.abc_ic_ab_back_mtrl_am_alpha); My question is that: How or

How can I change my custom toolbar icon dynamically

我与影子孤独终老i 提交于 2019-12-02 13:59:11
In my application I'm using toolbar which having imageview in it. I need to change that imageview dynamically . Here is my toolbar.xml : <?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:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="@color/white" android:id="@+id/toolbar" app:theme="@style/ToolbarStyle" > <ImageView android:id="@+id/actionBarImage" android:layout_width="match

Toolbar header's item alignment issue?

余生长醉 提交于 2019-12-02 12:45:28
Today i have stucked in one of the weird problem in Toolbar custom header. I am using the TextView in the center and ImageView which is at the right of the Toolbar . So i have used below lines of code in xml , please check it once. <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:theme="@style/AppTheme.NoActionBar.AppBarOverlay"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width=

Control the Toolbar icon with NavigationDrawer

回眸只為那壹抹淺笑 提交于 2019-12-02 10:27:32
I'm currently using within my app the android.support.v7.widget.Toolbar and android.support.v4.widget.DrawerLayout . Everything is working right, but there is a slight thing I want to change its behaviour. When I open the drawer, the whole drawer occupies the space of the Toolbar . It would be nice that the Toolbar stays on top, like in the Google Music app . How can I achieve that? But the most important thing isn't the previous. At first, the icon which is loaded in the application is the three stripped one . I've realised that after opening the drawer, the icon changes to an arrow. And

Tile not getting center in Collapsed toolbar

折月煮酒 提交于 2019-12-02 09:45:56
I tried setting collapsingToolbarLayout.setCollapsedTitleGravity(Gravity.CENTER); collapsingToolbarLayout.setExpandedTitleGravity(Gravity.CENTER); and almost all available links on INTERNET but i am not able to put the title in center of toolbar . plz help ! make your Toolbar like this <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:contentInsetEnd="0dp" app:contentInsetLeft="0dp" app:contentInsetRight="0dp" app:contentInsetStart="0dp" app

Toolbar with four icons how can set like this image?

折月煮酒 提交于 2019-12-02 08:28:40
Toolbar with four icons how can set like this image ? I want to set four icons like image in toolbar. i have make toolbar . & setting icons in menu_main.xml .But i am not getting .Why could any one help me why it is not coming ? styles.xml <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> </resources> toolbar.xml <LinearLayout xmlns:android="http://schemas

How should I import Toolbar tool in android studio?

ⅰ亾dé卋堺 提交于 2019-12-02 08:12:24
问题 I am trying to add a Toolbar to my android studio project. I found several explanations of how should I do it and they all explained these steps. In the first step, I should import android.support.v7.widget.Toolbar; but it does not succeed: The v7 characters bulbing in red and the warning message is: "Cannot resolve symbol 'v7'". I tried to replace the v7 with v4 which is included in the suggestions bar after the import android.support.____ but when I do so, the android studio claims it

Android - How to center a title (TextView) in a toolbar?

我与影子孤独终老i 提交于 2019-12-02 05:03:34
问题 On the left of my toolbar I have a logo, and I want to center a TextView in the same toolbar to act as my title. For some reason, the title does not center, and is instead on the right. Here is my attempt: <?xml version="1.0" encoding="utf-8"?> <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=".Register">

Cannot listen clicks on up caret

左心房为你撑大大i 提交于 2019-12-02 04:23:37
问题 I've a single activity(MainActivity) which extends actionbaractivity and implements NavigationDrawer. I've setup the drawertoggle in the activity itself. I'm creating new fragments from a fragment that was created by another fragment which is in turn created by the MainActivity. ( MainActivity -> HomeFragment ->AnotherFragment). MainActivity.java public class MainActivity extends ActionBarActivity implements FragmentDrawer.FragmentDrawerListener, TitleSetter, NavigationDrawerEnabler{

Show toolbar when view pager is swiped. [CoordinatorLayout]

只谈情不闲聊 提交于 2019-12-02 02:36:16
in my app I am using a viewpager with 3 fragments. In two of those I have recuclerviews. I took advatngage of the new Coordinator layout and made my toolbar hides/shows when scrolling on a recyclerview. My problem is the following Say the user is scrolling on a recyclerview list in fragment A and thus the toolbar is hidden. After that, the user performs a swipe and goes to fragment B which does not have a recycle view to scroll so the toolbar can appear again. Is there a way I can alter the layout_behaviout so that when the user swipes on the view pager the toolbar to be shown? NOTE: IF it is