android-toolbar

How do you remove an inflated menu/items from the new Lollipop Toolbar?

ぐ巨炮叔叔 提交于 2019-12-03 02:03:07
I include a v7 Toolbar in my layout. <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" /> I'm inflating a menu into it with the following: mToolbar.inflateMenu(R.menu.options_add_contact); Now how do I know remove/reset it? I've tried a couple shots in the dark: inflating an empty menu mToolbar.inflateMenu(0) moolbar.setMenu(null, null) toolbar.setMenu(null, null) I am not entirely sure if this is what you mean nor have tried it but. mToolbar.getMenu().clear(); should

(Design Support Library) CollapsingToolbarLayout — Toolbar not getting pinned on collapse

别等时光非礼了梦想. 提交于 2019-12-03 01:20:49
I'm having trouble integrating the Design Support Library into my application. For some reason, the toolbar collapses with the CollapsingToolbarLayout, and does not leave it pinned like in the Cheesesquare example by Chris Banes. https://github.com/chrisbanes/cheesesquare I didn't do anything different to my layout. In fact, I replaced my styles with his, and dropped in his layout. I wonder if using Toolbar, instead of android.support.v7.widget.Toolbar is causing this. Here is the problem. Here is my XML of the AppBar section. <android.support.design.widget.CoordinatorLayout xmlns:android=

AppBarLayout + TabLayout + CollapsingToolbarLayout + SwipeToRefresh

蓝咒 提交于 2019-12-03 00:58:32
I met a lot of issues related with my problem but nobody I found wanted the behaviour I'm looking for. I want a view pager with tabs and app bar, when the contained fragments are scrollable and are scrolled (toward bottom), I want the app bar to disapear but leave the tabs, when scrolled toward top, to re-apear. some of these fragments contain a SwipeToRefresh Layout (sometimes it causes problems). I tried a lot of configurations that always leave something wrong. for now I don't have the collapsing effect (it's always hidden) <?xml version="1.0" encoding="utf-8"?> <android.support.design

“Back button” using getSupportActionbar and appcompat v7 toolbar

寵の児 提交于 2019-12-03 00:46:12
问题 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);

How to customize the Action Bar subtitle Font?

一世执手 提交于 2019-12-02 23:16:42
I have created an ActionBar ( android.support.v7.widget.Toolbar ) as below. <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/myToolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize"> </android.support.v7.widget.Toolbar> In my ActionBar, other than the title, I also have Subtitle. However I would like to customize the Subtitle. In customize, I mean the font size, color and typeface. I've tried through various Theme and Style, and still unsuccessful. If there's a

Extended Toolbar with Custom View not Displaying with Full Width

为君一笑 提交于 2019-12-02 22:37:28
I went through lots of answers here related to Toolbar but none of the answers could help me. What I'm trying to achieve is to have an extended toolbar whhich will display a logo, possibly a name of the Activity/App, it will have an action button/drawer toggle to the right that will display a navigation-like drawer to the right, an overflow menu with other options like settings and also a navigation Tab at the bottom that will allow the user to move between different fragments (different days in a month). The way I'm trying to achieve this is through toolbar. First I create the toolbar and add

Set Title inToolBar from Fragment in Android

孤者浪人 提交于 2019-12-02 22:28:56
I have been using the latest Toolbar from AppCompatv7 lib.I have placed a textview in the ToolBar ViewGroup And I want to set a title into this Textview from the fragment in my activity.In case of a custom action bar ((ActionBarActivity)getActivity).setcustomView(..) would have done the job.But due to use of this ToolBar I am not able to use that.Also I have implemented a method in my BaseActivity that is inherited by all Activities.This BaseActivity contains my method to initialize a sliding drawer to the left.I have to initialize the initDrawerLayout() method in activity else the drawer

Clicking hamburger icon on Toolbar does not open Navigation Drawer

大城市里の小女人 提交于 2019-12-02 21:51:19
I have a simple android.support.v7.widget.Toolbar and all I am trying to do is to open a NavigationDrawer by pressing the "hamburger" icon in the top left corner. The "hamburger" button is visible, and when I start to pull from the left I see the animation on the button but pressing the button does not open/close the NavigationDrawer as I expect. I have followed the [Google Documentation][1] and still am not able to figure this out. Sorry for any confusion, below is the simplified code I am currently attempting to use: public class MainActivity extends AppCompatActivity implements View

getSupportActionBar().setTitle() vs toolbar.setTitle()

不问归期 提交于 2019-12-02 20:46:38
I am aware that there are two methods to setting a title in an Android Activity . Assuming I already have the following code... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_activity); ... Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar); setSupportActionBar(toolbar); ...I can use either this... getSupportActionBar().setTitle("My title"); ...or this... toolbar.setTitle("My title"); ...to set my title. My question is, which is the better practice ? Androider If you call setSupportActionBar(Toolbar) , then

Toolbar is hidden in nested PreferenceScreen

扶醉桌前 提交于 2019-12-02 20:42:24
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="defaultValue" android:key="key_global_setting" android:title="Global title" /> </PreferenceCategory>