Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ilyasKerbal/7711351458959b5ddb189a582a6d79b1 to your computer and use it in GitHub Desktop.
Save ilyasKerbal/7711351458959b5ddb189a582a6d79b1 to your computer and use it in GitHub Desktop.
Working sample of fragment inside CoordinatorLayout
<android.support.design.widget.CoordinatorLayout 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/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
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"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.AppBarLayout>
<fragment
android:id="@+id/some_fragment"
android:name="de.no.no.fragments.SomeFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/some_fragment"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
</android.support.design.widget.CoordinatorLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment