toolbar

how to pin title in Toolbar inside CollapsingToolbarLayout

好久不见. 提交于 2019-11-27 17:50:59
问题 Here is my layout: <android.support.design.widget.AppBarLayout <android.support.design.widget.CollapsingToolbarLayout ... <android.support.v7.widget.Toolbar ... /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> I want title stays in Toolbar, not in CollapsingToolbarLayout. So I changed my code from: mCollapsingToolbar = ... mCollapsingToolbar.setTitle(title); to: mTitleBar = ... setSupportActionBar(mTitleBar); getSupportActionBar()

Don't collapse Toolbar when RecyclerView fits the screen

可紊 提交于 2019-11-27 17:24:06
I've made an app using Android Design Library , with a Toolbar and TabLayout. Actually 2 tabs are present, both with 2 RecyclerView, that automatically collapse the Toolbar when scrolled. My question is: can I disable Toolbar collapsing when RecyclerView has few items and completely fits the screen (like in TAB 2)? I've seen a lot of examples like CheeseSquare , made by a Google employee where the issue is still present: even if the RecyclerView has just 1 item, the toolbar keeps hiding on scroll. I think I can just find out if the first item of the RecyclerView is visible on screen and if yes

How to change CollapsingToolbarLayout typeface and size?

拈花ヽ惹草 提交于 2019-11-27 17:01:05
I want to change CollapsingToolbarLayout font size and its typeface. How I can achieve that? Update Before we dive into the code let's first decide the textSize for our CollapsingToolbarLayout . Google published a website called material.io , this website also explains the best way on how to deal with Typography . The article mentioned about "Heading" category which also explains the recommended font size to use in sp . Although the article never mentioned the recommended CollapsingToolbarLayout's expanded size but the library com.android.support:design provides a TextAppearance for our case.

Display content under toolbar

孤街浪徒 提交于 2019-11-27 14:39:10
问题 Hello I'm attempting to simply put my content below the toolbar but at the moment when I run my application some of the content is hidden behind it when it should be below it. I have read up about using a frame layout to attempt to separate it but I have come a little stuck. I'm currently using a basic android studio navigation drawer template provided with the software and was wondering what changes I have to make. My coordinator layout <android.support.design.widget.AppBarLayout android

how to remove left margin of Android Toolbar?

我怕爱的太早我们不能终老 提交于 2019-11-27 13:32:04
问题 I'm trying to use toolbar for my project. Here is the code I am using: <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:layout_alignParentTop="true" android:background="?attr/colorPrimary" android:contentInsetLeft="0dp" android:elevation="@dimen/margin_padding_8dp" android:contentInsetStart="0dp"> <RelativeLayout android:id="@+id/rlToolbar" android:layout_width="match_parent" android:layout

how to remove shadow below actionbar with AppCompat.Light.NoActionBar?

允我心安 提交于 2019-11-27 12:35:23
I tried to remove the shadow below the toolbar with the Theme.AppCompat.Light.NoActionBar, using every recommendation of people who have ever answer it before, but no one worked. I tried <item name="android:windowContentOverlay">@null</item> and <item name="android:windowContentOverlay">@drawable/solid_line</item> .... <shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle"> <solid android:color="@color/accueil_color" /> <size android:height="15dp" /> </shape> and with this, android:elevation="0dp" the shadow goes from the top of the screen but not disapear.

How does this strange condition happens when show menu item icon in toolbar overflow menu?

跟風遠走 提交于 2019-11-27 12:31:33
问题 I want to show a overflow menu in toolbar(AppCompat-v7:22.1.1), below is my menu_main.xml. <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"> <item android:id="@+id/action_search" android:title="@string/action_search" android:icon="@mipmap/ic_menu_search" android:orderInCategory="100" android:actionViewClass="android.widget.SearchView" app

How to make the Toolbar snap into view or out of view when using Google Design Library?

不羁的心 提交于 2019-11-27 12:08:30
I am trying to achieve an effect like WhatsApp has, where the Toolbar (when scrolled) will clip into view magnetlike, or out of view magnetlike. What I have im my MainActivity XML: DrawerLayout - Base Layout CoordinatorLayout - Layout for the Appbar and Toolbar and Tabs AppBarLayout - For holding Toolbar and Tabs Toolbar - has THIS flag: app:layout_scrollFlags="scroll|enterAlways" SlidingTabLayout - Displays tabs ViewPager - For tabs RecyclerView - For coordinatorlayout Now dont get me wrong, it works, when I scroll down the toolbar gets pushed out of view but say I stop scrolling halfway,

How to fix getActionBar method may produce java.lang.NullPointerException

好久不见. 提交于 2019-11-27 11:52:11
I am using a toolbar as my actionbar in an activity. I am trying to add the method getActionBar().setDisplayHomeAsUpEnabled(true); to the Activity.java file for Up navigation for older devices. The method produces the following error message in Android Studio: Method invocation may produce java.lang.NullPointerException The Up navigation on the toolbar works fine on newer devices...now I'm trying to figure out how to make sure it will work for older devices. Please advise. From build.gradle: dependencies { compile "com.android.support:appcompat-v7:22.1.0" } From AndroidManifest.xml: android

Android: How to/Tutorial for changing ActionBar to ActionBarCompat (Toolbar)?

守給你的承諾、 提交于 2019-11-27 11:45:48
问题 I've been stuck on this, checked the official guidance, etc. Any tutorials/what are the steps to change from ActionBar to ActionBarCompat (for the Toolbar and support of older versions? I've imported appcompat-v7:21.0.+, tried getSupportActionBar(); and Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); setSupportActionBar(toolbar); changed theme to appcompat theme in styles... Any common errors to note or ideas? Keep getting this kind of error: java.lang.RuntimeException: