How can I make a toolbar, for example, in these photos:
This is the first state

And this is the second state

I am using the Collapse Toolbar with CalendarView. I use this library for CalendarView com.prolificinteractive:material-calendarview:1.0.1 And this is my xml code:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/rootLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="@dimen/app_bar_height" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:id="@+id/appbar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsingToolbarLayout" android:layout_width="match_parent" android:layout_height="match_parent" app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginStart="@dimen/expanded_toolbar_title_margin_start" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <com.prolificinteractive.materialcalendarview.MaterialCalendarView android:id="@+id/calendarView" android:layout_width="match_parent" android:layout_height="wrap_content" app:mcv_showOtherDates="all" app:mcv_selectionColor="#00F"> </com.prolificinteractive.materialcalendarview.MaterialCalendarView> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_collapseMode="pin" android:background="@color/primary_color" android:titleTextColor="@color/text_color" android:minHeight="?attr/actionBarSize" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/nickname_profile" android:text="@string/nickname" android:textColor="@color/text_color" android:textSize="24sp" android:layout_gravity="bottom|center" android:layout_marginBottom="20dp" android:layout_marginRight="40dp" /> </android.support.v7.widget.Toolbar> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/general_fragment" app:layout_behavior="@string/appbar_scrolling_view_behavior"> </FrameLayout> </android.support.design.widget.CoordinatorLayout>
And the second question: how to open the toolbar only when pressed without scrolling?
source share