Skip to content

Instantly share code, notes, and snippets.

@magnucki
Created August 7, 2015 12:19
Show Gist options
  • Select an option

  • Save magnucki/e317551d5c9dc62e7386 to your computer and use it in GitHub Desktop.

Select an option

Save magnucki/e317551d5c9dc62e7386 to your computer and use it in GitHub Desktop.
CoordinatorLayout with animated Toolbar and RecyclerView ready Framelayout for Fragment (with Navigation Drawer)
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
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"
android:id="@+id/MainDrawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="@dimen/navigation_elevation"
android:fitsSystemWindows="true"
tools:context=".activities.MainActivity"
>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/baseContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<FrameLayout
android:id="@+id/fragment_container"
android:clipToPadding="true"
android:layout_width="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_height="match_parent"
/>
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="@dimen/appbar_elevation"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
/>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_compat_margin"
android:baselineAlignBottom="true"
android:src="@mipmap/ic_new_message"
app:backgroundTint="?attr/colorAccent"
app:elevation="@dimen/fab_elevation"
app:pressedTranslationZ="12dp"
style="@style/FabStyle"
/>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/header"
app:menu="@menu/navigation"
/>
</android.support.v4.widget.DrawerLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment