I have a layout containing Navigation drawer, toolbar and bottom sheet. The RecyclerView is also present in the layout which does not scroll.
Root layout is CoordinatorLayout which encapsulates -> i) DrawerLayout & ii) NestedScrollView (For bottom sheet behavior)
DrawerLayout encapsulates -> i) LinearLayout & ii) NavigationView
LinearLayout encapsulates -> i) Toolbar ii) ConstraintLayout
ConstraintLayout encapsulates -> i) ViewPager ii) TextView iii) RecyclerView (This does not scroll)
Below is my xml :
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="e.a.exlorista_customer.MainActivity">
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorActionBarBackground"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/imgSliderVP"
android:layout_width="match_parent"
android:layout_height="200dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/nearByStoresTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Nearby Stores"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@+id/imgSliderVP"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"/>
<android.support.v7.widget.RecyclerView
<!-- This does not scroll -->
android:id="@+id/storeRV"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintTop_toBottomOf="@+id/nearByStoresTV" />
</android.support.constraint.ConstraintLayout>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/nav_header"
app:menu="@menu/drawer_menu" />
</android.support.v4.widget.DrawerLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/cartSummary_MainActivityNSV"
android:layout_width="match_parent"
android:layout_height="65sp"
android:clipToPadding="true"
android:background="@color/colorActionBarBackground"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
android:id="@+id/cartSummary_MainActivityLL"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp">
<TextView
android:id="@+id/cartItemCount_MainActivityTV"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.4"
android:textColor="@color/colorActionBarTitleText"
android:textStyle="bold"
android:textSize="20sp"
android:gravity="center_vertical"
android:text="1 item"/>
<Button
android:id="@+id/proceedToCart_MainActivityB"
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.6"
android:text="Proceed to cart"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
What I've tried :
- Encapsulated ConstraintLayout inside NestedScrollView
- Encapsulated RecyclerView inside NestedScrollView
Neither 1 nor 2 worked.
I'm new in Android so please bear with my naivety If this question involves any.