Clickable CardView inside NestedScroll doesn't trigger scrolling

I have a layout with a CoordinatorLayout, and AppBarLayout and a NestedScrollView, inside the NestedScrollView I have multiple CardViews, everything works ok until I set the CardViews to be clickable, then if I start a scroll within a CardView, scroll doesn't work.

This is my layout:

<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"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_height="256dp" android:layout_width="match_parent" app:contentScrim="?attr/colorPrimary" android:fitsSystemWindows="true" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|exitUntilCollapsed" android:fitsSystemWindows="true" app:contentScrim="?attr/colorPrimary"> <ImageView android:id="@+id/backdrop" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:fitsSystemWindows="true" app:layout_collapseMode="parallax"/> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_height="?attr/actionBarSize" android:layout_width="match_parent" app:layout_collapseMode="pin" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:id="@+id/nestedScroll" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_gravity="fill_vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="0dp" app:cardUseCompatPadding="true"> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <View android:layout_width="80dp" android:layout_height="80dp" android:background="@color/primary" /> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="4dp" android:paddingLeft="7dp" android:paddingRight="7dp" android:paddingBottom="7dp"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:lines="1" android:includeFontPadding="false" android:text="Title1" style="@android:style/TextAppearance.Medium" /> <TextView android:lines="2" android:text="Description 1" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout> </android.support.v7.widget.CardView> ... </LinearLayout> </android.support.v4.widget.NestedScrollView>

Answers

  • chamamochamamo USMember

    Did you found a solution for your problem?
    I have the same issue.

  • Clinton_RocksmithClinton_Rocksmith AUInsider, University ✭✭

    It could be that the LinearLayouts are too many. The nestedscrollview might also only be looking at the children 1 layer down to take control away from them so that they can scroll.

    Try taking out the LinearLayout between the NestedScrollView and the CardView and see how that goes.

Sign In or Register to comment.