Navigation drawer with bottom navigation - android-layout

In my application i want a navigation drawer with bottom navigation menu, but problem is that my container(content page) is overlapping the bottom navigation bar , i have attached my layout code with this question, please can anyone tell me what is wrong with the code?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.tunky.cardmaterial.MainActivity">
<RelativeLayout
android:id="#+id/container_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:openDrawer="start">
<FrameLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:id="#+id/card_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="#+id/card_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</LinearLayout>
</FrameLayout>
<include
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<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="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?android:attr/windowBackground"
app:menu="#menu/navigation" />
</RelativeLayout>

I have updated your layout xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:openDrawer="start">
<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="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
<RelativeLayout
android:id="#+id/container_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/navigation">
<include
android:id="#+id/app_bar_layout"
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<FrameLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="#id/app_bar_layout"
android:layout_weight="1">
<LinearLayout
android:id="#+id/card_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="#+id/card_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?android:attr/windowBackground"
app:menu="#menu/navigation" />
</RelativeLayout>

Related

CollapsingToolbarLayout + RecyclerView not working when RV scrolls

My fragment inside collpasetoolbar not working when recyclerview scrolls, I tried all but get no success. I do not know what can I do anymore.
To explain my recyclerview is in another file bellow collpasetoolbar as included file inside a coordinator layout.
There is my XML code and I cannot make its works!
...
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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/productLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="br.com.product.feature.product.ProductActivity">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
style="#style/DefaultConstraintToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<include
android:id="#+id/viewToolbarSearch"
layout="#layout/product_view_toolbar_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/design_default"
android:layout_marginEnd="#dimen/design_default"
android:layout_marginBottom="#dimen/design_default" />
</androidx.appcompat.widget.Toolbar>
<ViewFlipper
android:id="#+id/viewFlipperProductList"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#id/tabBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/toolbar">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:elevation="0dp">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="#+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="#dimen/margin16dp"
android:background="#color/design_white"
app:contentScrim="#color/design_white"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways">
<androidx.fragment.app.FragmentContainerView
android:id="#+id/fragment_container_header_product"
class="br.com.product.feature.product.adapter.ProductListViewSetupFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
tools:layout="#layout/activity_product_header" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<br.concrete.base.ui.component.productListing.ProductListingView
android:id="#+id/productListingView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:displayAs="GridTwoColumns"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
app:showDecoration="true" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<include
layout="#layout/item_product_not_found"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<br.com.viavarejo.component.screenstate.ErrorStateView
android:id="#+id/page_try_again_product"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</ViewFlipper>
<include
android:id="#+id/tabBar"
layout="#layout/view_tab_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

ListView in BottomSheet not scrolling

Writing for Android API 23 and above (testing on API 24 and 25).
I have written an XML which attempts to put a ListView inside of a BottomSheet. When I attempt to scroll my ListView (in any direction) the BottomSheet scrolls rather than the ListView.
I've tried the following workaround without any success:
ListView in BottomSheet
My XML layout file is as follows:
<?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:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="#+id/refresh_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onButtonPress"
android:text="#string/refresh_button" />
<RelativeLayout
android:id="#+id/map_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<fragment
android:id="#+id/map_fragment"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/floating_action_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="15dp"
android:layout_marginRight="15dp"
android:clickable="true"
app:srcCompat="#android:drawable/ic_menu_mylocation" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="?android:attr/windowBackground"
android:clipToPadding="true"
android:fillViewport="true"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:orientation="horizontal">
<TextView
android:id="#+id/textView11"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="16dp"
android:text="Stations"
android:textColor="#ffffff"
android:textSize="24sp" />
</LinearLayout>
<com.example.nicsutherland.stationfinder.Adapters.BottomSheetListView
android:id="#+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.design.widget.CoordinatorLayout>
My java class contains the following code in the onCreate() method:
View bottomSheet = findViewById( R.id.bottom_sheet );
mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
mBottomSheetBehavior.setPeekHeight(300);
How can I get to a point where my ListView will scroll independently of my BottomSheet?
try this :
com.example.nicsutherland.stationfinder.Adapters.BottomSheetListView
android:id="#+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true"\\insert this line
/>
Set the BottomSheetDialog Cancelable false and CanceledOnTouchOutside true
bottomSheetDialog.setCancelable(false);
bottomSheetDialog.setCancelable(false);
bottomSheetDialog.setCanceledOnTouchOutside(true);

Android Studio DrawerLayout scrimcolor not showing

I have an activity that uses the following layout:
<android.support.v4.widget.DrawerLayout
android:id="#+id/root_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:openDrawer="start"
xmlns:tools="http://schemas.android.com/tools">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbarlayout_main_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_main_activity"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
<android.support.design.widget.TabLayout
android:id="#+id/tablayout_main_activity"
app:tabIndicatorHeight="3dp"
app:tabIndicatorColor="#android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.view.ViewPager
android:id="#+id/viewpager_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWindowBackground"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigationview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#color/colorWindowBackground"
android:fitsSystemWindows="true"
android:layout_gravity="start">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/drawer_header" />
<ExpandableListView
android:id="#+id/expandablelistview_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="#null"
android:divider="#null"
android:dividerHeight="0dp"/>
</LinearLayout>
</ScrollView>
</android.support.design.widget.NavigationView>
I have tried all that I could think of, such as; putting the navigationView inside the appbarlayout in different places, putting it before the appbarlayout and after it and lastly trying to set the scrimcolor dynamically in the oncreate method of the activity. None of these things worked, does someone know the solution to my problem?
After a lot of trying I made it working. The reason why is not clear to me but here is the working layout for the people who have the same problem:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
android:id="#+id/root_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:openDrawer="start"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:id="#+id/linearlayout_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbarlayout_main_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_main_activity"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
<android.support.design.widget.TabLayout
android:id="#+id/tablayout_main_activity"
app:tabIndicatorHeight="3dp"
app:tabIndicatorColor="#android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWindowBackground"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigationview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#color/colorWindowBackground"
android:fitsSystemWindows="true"
android:layout_gravity="start">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/drawer_header" />
<ExpandableListView
android:id="#+id/expandablelistview_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="#null"
android:divider="#null"
android:dividerHeight="0dp"/>
</LinearLayout>
</ScrollView>
</android.support.design.widget.NavigationView>

recycle view inside scroll view not scrolling

Recycle view is not scrolling inside Scroll View. I have Used Nested Scroll View instead but it doesn't work either. here is My xml code
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/coordinatorlayout"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<include layout="#layout/content_main" />
<android.support.design.widget.AppBarLayout
android:id="#+id/appbarlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay"
app:behavior_scrolling_appbar_peek_height="#dimen/bottom_sheet_peek_height"
app:layout_behavior="com.example.deepdepindersingh.adore.ui.lib.ScrollingAppBarLayoutBehavior">
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
app:behavior_peekHeight="#dimen/bottom_sheet_peek_height"
android:paddingTop="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:id="#+id/bottom_sheet"
app:layout_behavior="com.example.deepdepindersingh.adore.ui.lib.BottomSheetBehaviorGoogleMapsLike"
app:anchorPoint="#dimen/anchor_point"
android:fitsSystemWindows="true">
<ScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true"
android:layout_below="#+id/llOptions">
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:background="#fff">
</android.support.v7.widget.RecyclerView>
</ScrollView>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:layout_anchor="#id/bottom_sheet"
app:layout_anchorGravity="top|right|end"
android:src="#android:drawable/ic_dialog_map"
android:layout_margin="#dimen/fab_margin"
app:layout_behavior="com.example.deepdepindersingh.adore.ui.lib.ScrollAwareFABBehavior"
android:clickable="true"/>
</android.support.design.widget.CoordinatorLayout>
and i am using Grid Adapter to display array list
grid-Single.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<ImageView
android:id="#+id/grid_image"
android:layout_width="50dp"
android:layout_height="50dp">
</ImageView>
<TextView
android:id="#+id/grid_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:textSize="9sp" />
</LinearLayout>
Please Help in solving my problem.

CoordinatorLayout doesn't work with NestedScrollView inside Fragment in ViewPager

I have an Activity with next layout
Activity layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
android:id="#+id/issue_browse_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/app_default_color"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/issue_browse_toolbar"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
<android.support.design.widget.TabLayout
android:id="#+id/issue_browse_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/issue_browse_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
ViewPager after instantiating has 2 fragments
First visible fragment's layout
<?xml version="1.0" encoding="utf-8"?>
<ViewSwitcher xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/issue_browse_view_switcher"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white">
<FrameLayout
android:id="#+id/issue_browse_status_buttons_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="#dimen/issue_status_browse_buttons"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/issue_browse_fragment_view_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="start" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="1000dp"
android:text="end" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/issue_browse_load_error_text"
style="#style/list_view_empty_view_style"
android:drawableTop="#drawable/error" />
<TextView
android:id="#+id/issue_browse_refresh_after_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/content_offset_small"
android:textColor="#c0bebe" />
</LinearLayout>
</ViewSwitcher>
How you can see, there is NestedScrollView with app:layout_behavior="#string/appbar_scrolling_view_behavior"
And regardless of the fact, has NestedScrollView this tag or not, Coordinator doesn't hide Toolbar.
Where is error in this code?
You are not using "CollapsingToolbarLayout"
Doc says:
CollapsingToolbarLayout is a wrapper for Toolbar which implements a
collapsing app bar. It is designed to be used as a direct child of a
AppBarLayout.
For your understanding refer below example
<android.support.design.widget.CoordinatorLayout
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v4.view.ViewPager
android:id="#+id/issue_browse_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
style="#style/ToolBarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

Resources