android - disable touch events for RecyclerView inside NestedScrollV -
i have layout below:
<android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="@dimen/detail_backdrop_height" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar" app:elevation="0dp"> <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:elevation="0dp" app:expandedtitlemarginend="64dp" app:expandedtitlemarginstart="48dp" app:layout_scrollflags="scroll|exituntilcollapsed"> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" app:layout_collapsemode="parallax"> <imageview android:id="@+id/backdrop" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" android:scaletype="centercrop" android:src="@drawable/devito" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/rating" android:fitssystemwindows="true" android:padding="8dp" android:text="danny devitto" android:textsize="24sp" /> </relativelayout> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:elevation="0dp" 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/scrollview" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="info" android:textappearance="@style/textappearance.appcompat.title" /> <android.support.v7.widget.cardview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/card_margin"> <linearlayout style="@style/widget.cardcontent" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.recyclerview android:id="@+id/somelist" android:layout_width="match_parent" android:layout_height="wrap_content" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/cheese_ipsum" /> </linearlayout> </android.support.v7.widget.cardview> <android.support.v7.widget.cardview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="@dimen/card_margin" android:layout_marginleft="@dimen/card_margin" android:layout_marginright="@dimen/card_margin"> <linearlayout style="@style/widget.cardcontent" android:layout_width="match_parent" android:layout_height="wrap_content"> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="friends" android:textappearance="@style/textappearance.appcompat.title" /> <android.support.v7.widget.recyclerview android:id="@+id/anotherlist" android:layout_width="match_parent" android:layout_height="wrap_content" /> </linearlayout> </android.support.v7.widget.cardview> </linearlayout> </android.support.v4.widget.nestedscrollview> </android.support.design.widget.coordinatorlayout>
where idea toolbar collapsing when scrolled (down?). there problem touch event occurred. if scroll initiated on element except recyclerview, works charm. if scroll touch initiated on recyclerview, nestedscrollview starts scrolling without toolbar collapse or expand. recyclerviews use custom layout manager, wraps content (each recyclerview has few items). here question. how tell recyclerview not interfere nestedscrollview's collapsing/expanding behavior?
i had same problem nestedscrollview used
android:nestedscrollingenabled="false"
and problem gone, please try add , tell me if works
good luck
Comments
Post a Comment