将CoordinatorLayout与AppBarLayout一起使用时滚动问题

时间:2018-06-12 12:21:14

标签: android android-appbarlayout android-collapsingtoolbarlayout

我在AppBarLayoutCoordinatorLayoutAppBarLayout区域从上到下滚动然后一段时间突然向上滚动。

这是result1 result2

布局:

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:orientation="vertical"
        app:elevation="0dp">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

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

                <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_scrollFlags="scroll">

                    <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
                        xmlns:app="http://schemas.android.com/apk/res-auto"
                        android:id="@+id/imgThumbDetails"
                        android:layout_width="0dp"
                        android:layout_height="0dp"
                        android:adjustViewBounds="true"
                        android:visibility="invisible"
                        app:layout_constraintDimensionRatio="W,1:1.5"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />


                    <cn.jzvd.JZVideoPlayerStandard
                        android:id="@+id/videoplayerDetails"
                        android:layout_width="0dp"
                        android:layout_height="0dp"
                        android:visibility="invisible"
                        app:layout_constraintDimensionRatio="W,1:1.5"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />


                    <com.videosgifsimages.smallbang.SmallBangView
                        android:id="@+id/like_heart"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="8dp"
                        android:layout_marginEnd="8dp"
                        android:layout_marginStart="8dp"
                        android:layout_marginTop="8dp"
                        android:clickable="false"
                        android:visibility="invisible"
                        app:circle_end_color="#00000000"
                        app:circle_start_color="#00000000"
                        app:dots_primary_color="#c60d2c"
                        app:dots_secondary_color="#e9cf0b"
                        app:layout_constraintBottom_toBottomOf="@+id/videoplayerDetails"
                        app:layout_constraintEnd_toEndOf="@+id/videoplayerDetails"
                        app:layout_constraintStart_toStartOf="@+id/videoplayerDetails"
                        app:layout_constraintTop_toTopOf="@+id/videoplayerDetails">

                        <ImageView
                            android:id="@+id/image"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:src="@drawable/ic_like_animate" />
                    </com.videosgifsimages.smallbang.SmallBangView>


                </android.support.constraint.ConstraintLayout>

                <include
                    layout="@layout/layout_bottom_list_item_listing"
                    android:layout_width="match_parent"
                    android:layout_height="54dp"
                    app:layout_scrollFlags="scroll" />

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="100dp"
                    android:background="#f2f2f2"
                    app:layout_scrollFlags="scroll">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="ad"
                        android:textColor="#565656"
                        android:textSize="12sp"
                        android:textStyle="normal" />

                </FrameLayout>

            </LinearLayout>




        </FrameLayout>


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

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerViewDetails"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_gravity="bottom"
        android:background="#ecf0f1"
        android:orientation="horizontal"
        android:padding="10dp">


        <EditText
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:background="@drawable/rounded_edittext_post_comment"
            android:hint="Comment"
            android:inputType="textPersonName"
            android:paddingEnd="15dp"
            android:paddingStart="15dp" />


        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_gravity="center"
            android:layout_marginStart="17dp"
            android:background="@drawable/circle_background_post_comment_btn"
            android:scaleType="centerInside"
            android:src="@drawable/ic_post_comment" />

    </LinearLayout>

    <View
        android:id="@+id/viewDimBgForBottomSheet"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#99000000"
        android:visibility="gone" />

    <include layout="@layout/bottom_sheet" />
</android.support.design.widget.CoordinatorLayout>

0 个答案:

没有答案