android-toolbar

CollapsingToolbarLayout not working(collapsing)when scrolled

拈花ヽ惹草 提交于 2019-11-30 12:42:39
I am trying to create a CollapsingToolbarLayout and below it a listview, when the listview is scrolled the Toolbar should collapse, but its not working when scrolled the Toolbar is not collapsing. Used this tutorial: http://android-developers.blogspot.in/2015_05_01_archive.html Note: The FrameLayout contains the listview <LinearLayout 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:orientation="vertical" android:scrollbars="vertical"> <android.support

How to hide toolbar while scrolling listview up? (Just like google play store)

强颜欢笑 提交于 2019-11-30 12:37:47
Ok, so hiding the action bar is something doable. But, how can we hide the (newly introduced) toolbar in our activity? I am making an app with an activity having theme as theme.apcompat.light.noactionbar(to hide the action bar) , I have placed a toolbar with slidingtablayout below it. And below it is my listview. What I want is to hide the toolbar when I scroll the listview up. But the slidingtablayout should remain there. And while in middle of the listview if I scroll down, the toolbar should again be visible. Jared Burrows Updated (8/24/2015): Please see my latest answer here using the

Android Toolbar + Tab Layout + Drawer, Hide toolbar when scrolling and take TabLayout to the top

半腔热情 提交于 2019-11-30 12:33:36
问题 I have activity which has drawer attached to it. Each menu of the drawer is a fragment, and under one of the menu I have a fragment with TabLayout , and each tab contains a RecyclerView . So now, when I scroll the RecyclerView , tab layout is getting hidden but ToolBar remains at the top. What I need is to ToolBar to get hidden( scrollFlags:scroll|enterAlways ), and TabLayout should get shown at the top. So current setup is: Activity with attached DrawerLayout -> Fragment with TabLayout ->

Android centre title with navigation drawer

痴心易碎 提交于 2019-11-30 09:16:43
I currently have a navigation drawer with a toolbar that has a title, i wish to centre this title within the toolbar but the toolbar does not seem to take into consideration the drawer icon as you can see in the following picture. whereas when i use the same toolbar layout for other activities that are not inside the navigation drawer the title is centred perfectly, as show in this picture: So how do i get it to take into account this icon? Here is my layout: <android.support.design.widget.AppBarLayout xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android

Setting a subtitle on my Toolbar from a fragment

半世苍凉 提交于 2019-11-30 09:05:42
I am having some trouble setting the sub-title in my Toolbar from my fragment. I keep getting a Null Pointer Exception at the setSubTitle. @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getActivity().getActionBar().setSubtitle("About"); // NULL POINTER EXCEPTION here } Adding the toolbar to the host activity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { Log.w(

Custom icon in Android toolbar

让人想犯罪 __ 提交于 2019-11-30 08:52:46
I'm trying to use define a custom icon in the support Toolbar but the only icon shown is a left arrow... I tried to set it in the layout and programmatically but the result is the same. Here is my Activity public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar); toolbar.setNavigationIcon(R.drawable.ic_launcher); toolbar.setTitle(""); setSupportActionBar(toolbar); } And my toolbar layout <android

Collapsing Toolbar and DrawerLayout

房东的猫 提交于 2019-11-30 07:43:08
I created a layout with parallax effect which I use in a fragment. <android.support.design.widget.CoordinatorLayout 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="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match

How does one remove default Toolbar menu items and replace with different icons?

笑着哭i 提交于 2019-11-30 07:31:21
I am using a toolbar from v7.widget.Toolbar support library and v7.app.ActionBarActivity. When the onCreateOptionsMenu is inflated on the toolbar, I see a standard "Back" arrow on the leftmost side of the toolbar and standard "Overflow" dots on the rightmost portion of the toolbar. I would like to hide or disable these default icons and replace with another set of Android recommended icons. Any ideas on how to fix? MyActiviy.java: public class MyActivity extends ActionBarActivity { private Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

How to show Toolbar's logo, icon, title, subtitle when wrapped in a CollapsingToolbarLayout?

断了今生、忘了曾经 提交于 2019-11-30 07:29:26
After Android Support Design Library was released, I wanted to implement an effect like a page of Twitter Profile , in which Toolbar 's title and subtitle could be changed as screen scrolled vertically. So I tried to use CoordinatorLayout , AppBarLayout , CollapsingToolbarLayout and Toolbar from Android Support Design Library to achieve this effect. Everything worked as expected except that Toolbar 's content couldn't be showed or changed as I wanted. I should have been wanting to display collapseIcon , navigationIcon , title , subtitle of Toolbar , but they didn't show up even though I had

Tool bar setNavigationOnClickListener breaks ActionbarDrawerToggle functionality

霸气de小男生 提交于 2019-11-30 06:59:42
问题 I'm swapping out the action bar for the tool bar, and I nearly have every piece of the puzzle in place. My issue is specifically if I navigate 'up' and restore the navigation drawer, the drawer toggle button no longer works. I figured out if I set the drawer mode to unlocked I have the ability to swipe to open the drawer, but can't click to open the drawer. So I load fragment A, drawer behaviour is fine, go down to fragment B and apply the up icon, hit up to go back to A, and the drawer won't