嵌套的ScrollView包含RecyclerView
和AppbarLayout
在拖动时不滚动的片段。
我甚至在我的app:layout_behavior="@string/appbar_scrolling_view_behavior"
中添加了RecyclerView
,如某些答案所示,但这不起作用。
<android.support.design.widget.CoordinatorLayout
android:id="@+id/profile_view_cl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_control_highlight"
android:fitsSystemWindows="true"
android:focusableInTouchMode="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_8dp"
app:layout_behavior="com.practo.docnet.widgets.FlingBehavior"
android:theme="@style/Theme.AppCompat.NoActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_tool_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:contentScrim="@color/color_primary"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_white"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.5">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center_horizontal"
android:layout_marginBottom="@dimen/profile_pic_margin_bottom"
android:layout_marginTop="@dimen/profile_pic_margin_top"
android:background="@android:color/white"
android:elevation="@dimen/card_padding"
android:gravity="center_horizontal|top"
app:cardCornerRadius="@dimen/default_elevation"
app:cardUseCompatPadding="false">
<ImageView
android:id="@+id/profile_pic_iv"
android:layout_width="@dimen/profile_pic_size"
android:layout_height="@dimen/profile_pic_size"
android:layout_gravity="center_horizontal"
android:layout_margin="@dimen/profile_pic_margin"
android:adjustViewBounds="true"
android:scaleType="fitXY"
/>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:orientation="vertical">
<ImageView
android:id="@+id/cover_pic"
android:layout_width="match_parent"
android:layout_height="@dimen/cover_pic_height"
android:layout_gravity="top"
android:fitsSystemWindows="true"
android:scaleType="fitXY"
android:src="@drawable/profile_placeholder"
android:tint="@color/cover_pic_tint" />
<LinearLayout
android:id="@+id/layout_titles"
android:layout_width="wrap_content"
android:layout_height="@dimen/titles_layout_height"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/titles_layout_margin_top"
android:orientation="vertical">
<TextView
android:id="@+id/first_name_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="sans-serif"
android:gravity="bottom|center"
android:textColor="@color/color_black"
android:textSize="@dimen/text_sz_xxxlarge" />
<TextView
android:id="@+id/designation_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/designation_text_margin_top"
android:fontFamily="sans-serif-light"
android:textColor="@color/color_black"
android:textSize="@dimen/text_sz_xlarge" />
<TextView
android:id="@+id/location_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/location_text_margin_top"
android:fontFamily="sans-serif-light"
android:textColor="@color/color_black"
android:textSize="@dimen/text_sz_xlarge" />
<TextView
android:id="@+id/no_of_connections_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/card_padding_more"
android:background="?selectableItemBackground"
android:fontFamily="sans-serif-medium"
android:textColor="@color/color_primary"
android:textSize="@dimen/text_sz_xxlarge" />
<TextView
android:id="@+id/connections_text_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/connections_text_margin_top"
android:background="?selectableItemBackground"
android:fontFamily="sans-serif-light"
android:text="@string/connections"
android:textColor="@color/color_black"
android:textSize="@dimen/text_sz_xlarge" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="center_horizontal"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/back_icon"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<TextView
android:id="@+id/title_textview"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/margin_8dp"
android:gravity="center_vertical"
android:textColor="@android:color/white"
android:textSize="@dimen/text_sz_xxlarge" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foregroundGravity="fill_vertical"
android:layout_marginTop="@dimen/margin_8dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/cards_layout_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:focusableInTouchMode="true"
android:orientation="vertical">
<include layout="@layout/profile_connect_layout" />