Skip to content

Instantly share code, notes, and snippets.

@feresr
Created August 13, 2015 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feresr/a6812051499ab7af6c64 to your computer and use it in GitHub Desktop.
Save feresr/a6812051499ab7af6c64 to your computer and use it in GitHub Desktop.
Expandable toolbar
<?xml version="1.0" encoding="utf-8"?>
<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:background="#fff"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="190dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
app:contentScrim="?attr/colorPrimaryDark"
android:layout_height="match_parent"
android:id="@+id/collapsing_toolbar"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/wallpaper_dashboard"/>
<LinearLayout
android:layout_width="match_parent"
android:background="#cc333333"
android:orientation="vertical"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
app:layout_collapseMode="parallax"
android:paddingBottom="20dp"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<com.feresr.restapp.RoundedImageView
android:id="@+id/waiter_picture"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/ic_waiter"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" />
<TextView
android:id="@+id/waiter_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/waiter_picture"
android:fontFamily="sans-serif"
android:text="Fernando Raviola"
android:textColor="@color/lightPrimary"
android:textSize="38sp" />
<TextView
android:id="@+id/waiter_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/waiter_name"
android:layout_marginTop="-5dp"
android:layout_toRightOf="@id/waiter_picture"
android:fontFamily="sans-serif-light"
android:text="feresr"
android:textColor="@color/secondaryText"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:id="@+id/empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:gravity="center">
<ImageView
android:id="@+id/empty_icon"
android:layout_width="100dp"
android:alpha=".5"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:src="@drawable/pizza_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/empty_icon"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:gravity="center"
android:text="@string/no_orders" />
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</android.support.design.widget.CoordinatorLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment