Created
January 2, 2018 10:12
-
-
Save eneim/afa3b4b8443a88eb745c5dd0b334b34e to your computer and use it in GitHub Desktop.
Sample ViewPager + Drawer + CoordinatorLayout, answering this: https://www.reddit.com/r/androiddev/comments/7nkjjy/annoying_fragment_and_appbar_overlap/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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/drawer_layout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true" | |
tools:openDrawer="start" | |
> | |
<android.support.design.widget.CoordinatorLayout | |
android:id="@+id/coordinator_layout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true" | |
> | |
<android.support.design.widget.AppBarLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
> | |
<android.support.v7.widget.Toolbar | |
android:id="@+id/toolbar" | |
android:layout_width="match_parent" | |
android:layout_height="?attr/actionBarSize" | |
android:background="?attr/colorPrimary" | |
app:popupTheme="what-ever-theme" | |
/> | |
</android.support.design.widget.AppBarLayout> | |
<android.support.v4.view.ViewPager | |
android:id="@+id/content_home" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
app:layout_behavior="@string/appbar_scrolling_view_behavior" | |
/> | |
<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="what-ever-dimen" | |
app:srcCompat="what-ever-drawable" | |
/> | |
</android.support.design.widget.CoordinatorLayout> | |
<android.support.design.widget.NavigationView | |
android:id="@+id/nav_view" | |
android:layout_width="wrap_content" | |
android:layout_height="match_parent" | |
android:layout_gravity="start" | |
android:fitsSystemWindows="true" | |
app:headerLayout="what-ever-layout" | |
app:menu="what-ever-menu" | |
/> | |
</android.support.v4.widget.DrawerLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment