CollapsingToolbarLayout свернуто с вложенным scrollview по умолчанию

Я не понимаю, почему мой макет CollapsingToolbar сворачивается, когда мое представление создается по умолчанию.

Я думаю это NestedScrollViewто ответственное но я не понимаю почему.

Это сводит меня с ума.

Макет моей деятельности :

    <android.support.design.widget.AppBarLayout
        android_id="@+id/app_bar"
        android_layout_width="match_parent"
        android_layout_height="@dimen/app_bar_height"
        android_fitsSystemWindows="true"
        android_theme="@style/AppTheme.AppBarOverlay">
        <android.support.design.widget.CollapsingToolbarLayout
            android_id="@+id/toolbar_layout"
            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/pager_images"
            android_layout_width="match_parent"
            android_layout_height="match_parent"
            android_fitsSystemWindows="true"
            android_scaleType="centerCrop"
            app_layout_collapseMode="parallax"/>

            <android.support.v7.widget.Toolbar
                android_id="@+id/toolbar"
                android_layout_width="match_parent"
                android_layout_height="?attr/actionBarSize"
                app_layout_collapseMode="pin"
                app_popupTheme="@style/AppTheme.PopupOverlay" />
        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_product" />


</android.support.design.widget.CoordinatorLayout>

И мой content_layout с вложенным scrollview :

<LinearLayout
    android_layout_width="match_parent"
    android_layout_height="match_parent"
    android_orientation="vertical"
    android_padding="4dp">

    <include layout="@layout/layout_progress" />

    <TextView
        android_id="@+id/tv_reference"
        android_layout_width="wrap_content"
        android_layout_height="wrap_content"
        android_layout_gravity="center_horizontal"
        android_layout_marginBottom="2dp"
        android_layout_marginTop="8dp"
        android_ellipsize="end"
        android_maxLines="1"
        android_text=""
        android_textColor="@color/MyApp_gray"
        android_textSize="10sp"
        android_textStyle="bold" />

    <TextView
        android_id="@+id/tv_title"
        android_layout_width="wrap_content"
        android_layout_height="wrap_content"
        android_layout_gravity="center_horizontal"
        android_layout_marginBottom="8dp"
        android_layout_marginTop="8dp"
        android_ellipsize="end"
        android_fontFamily="sans-serif-light"
        android_maxLines="2"
        android_text=""
        android_textColor="@color/cardview_dark_background"
        android_textSize="16sp" />


    <android.support.v7.widget.CardView 
        
        android_id="@+id/card_view_choix"
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_layout_marginBottom="4dp"
        android_layout_marginLeft="4dp"
        android_layout_marginRight="4dp"
        android_layout_marginTop="4dp"
        android_background="@android:color/white"
        card_view_cardCornerRadius="2dp"
        card_view_cardElevation="1dp">

        <LinearLayout
            android_layout_width="match_parent"
            android_layout_height="wrap_content"
            android_gravity="center"
            android_orientation="vertical"
            android_paddingLeft="10dp"
            android_paddingRight="10dp">


            <TextView
                android_id="@+id/tv_quantity_title"
                android_layout_width="wrap_content"
                android_layout_height="wrap_content"
                android_layout_gravity="center_horizontal"
                android_layout_marginTop="8dp"
                android_ellipsize="end"
                android_maxLines="2"
                android_text="@string/product_quantity"
                android_textColor="@color/cardview_dark_background"
                android_textSize="12sp" />

            <com.MyApp.utils.HorizontalNumberPicker
                android_id="@+id/horizontal_qty_picker"
                android_layout_width="wrap_content"
                android_layout_height="wrap_content" />


            <View
                android_layout_width="match_parent"
                android_layout_height="1px"
                android_layout_marginLeft="0dp"
                android_layout_marginRight="0dp"
                android_background="@color/MyApp_gray" />

            <LinearLayout
                android_layout_width="match_parent"
                android_layout_height="wrap_content"
                android_layout_margin="20dp"
                android_gravity="center"
                android_orientation="horizontal">

                <TextView
                    android_id="@+id/tv_price"
                    android_layout_width="wrap_content"
                    android_layout_height="wrap_content"
                    android_gravity="center_horizontal"
                    android_text=""
                    android_textColor="@color/cardview_dark_background"
                    android_textSize="18sp"
                    android_textStyle="" />

                <TextView
                    android_id="@+id/tv_price_unit"
                    android_layout_width="wrap_content"
                    android_layout_height="wrap_content"
                    android_gravity="center_horizontal"
                    android_text=" / Unité"
                    android_textColor="@color/cardview_dark_background"
                    android_textSize="16sp" />

            </LinearLayout>

            <TextView
                android_id="@+id/tv_duration"
                android_layout_width="wrap_content"
                android_layout_height="wrap_content"
                android_layout_gravity="center_horizontal"
                android_layout_marginBottom="10dp"
                android_drawableLeft="@drawable/ic_hourglass_red_18dp"
                android_drawablePadding="4dp"
                android_gravity="center"
                android_maxLines="2"
                android_text=""
                android_textColor="@color/MyApp_gray"
                android_textSize="12sp"
                android_visibility="gone" />

        </LinearLayout>

    </android.support.v7.widget.CardView>

    <Button
        android_id="@+id/btn_book"
        android_layout_width="wrap_content"
        android_layout_height="wrap_content"
        android_layout_gravity="center_horizontal"
        android_layout_marginBottom="30dp"
        android_layout_marginTop="10dp"
        android_background="@drawable/btn_primary"
        android_drawableLeft="@drawable/ic_add_shopping_cart_white_24dp"
        android_drawablePadding="10dp"
        android_paddingLeft="20dp"
        android_paddingRight="20dp"
        android_text="@string/store_action_book"
        android_textColor="@android:color/white"
        android_textStyle="bold" />

    <TextView
        android_id="@+id/tv_desc_title"
        android_layout_width="wrap_content"
        android_layout_height="wrap_content"
        android_layout_gravity="center_horizontal"
        android_layout_marginBottom="2dp"
        android_layout_marginTop="20dp"
        android_ellipsize="end"
        android_maxLines="1"
        android_text="@string/product_description"
        android_textColor="@color/cardview_dark_background"
        android_textSize="14sp"
        android_textStyle="bold" />

    <android.support.v7.widget.CardView 
        
        android_id="@+id/card_view"
        android_layout_width="match_parent"
        android_layout_height="wrap_content"
        android_layout_marginBottom="4dp"
        android_layout_marginLeft="4dp"
        android_layout_marginRight="4dp"
        android_layout_marginTop="4dp"
        android_background="@android:color/white"
        card_view_cardCornerRadius="2dp"
        card_view_cardElevation="1dp">

        <LinearLayout
            android_layout_width="match_parent"
            android_layout_height="wrap_content"
            android_orientation="vertical"
            android_paddingLeft="10dp"
            android_paddingRight="10dp">

            <at.blogc.android.views.ExpandableTextView
                android_id="@+id/tv_description"
                android_layout_width="wrap_content"
                android_layout_height="wrap_content"
                android_layout_marginBottom="0dp"
                android_layout_marginTop="10dp"
                android_ellipsize="end"
                android_maxLines="5"
                android_text=""
                android_textColor="@color/MyApp_gray"
                android_textIsSelectable="true"
                android_textSize="12sp"
                app_animation_duration="1000" />

            <Button
                android_id="@+id/btn_more"
                android_layout_width="wrap_content"
                android_layout_height="wrap_content"
                android_layout_gravity="center_horizontal"
                android_background="@android:color/transparent"
                android_text="@string/action_expand"
                android_textColor="@color/MyApp_red" />
        </LinearLayout>

    </android.support.v7.widget.CardView>

</LinearLayout>

Отрисовка :
Отрисовка

Еще более странно, что он все еще работает, когда я использую NestedScrollView сверху. Похоже, что NestedScrollView автоматически прокручивается вниз.

1 ответ