Прокрутка не работает внутри элемента списка recycler-view

Я использую recycler-view в activity_main.xml и несколько карт в card_item_list.xml. Я не могу прокручивать просмотры карт. Если я прикоснусь к чему-либо, кроме cardview, он работает отлично. Но если я нажимаю на cardview, поведение прокрутки recycler-view не работает.

activity_main.xml

   <ViewFlipper
                android:id = "@+id/day_navigation"
                android:layout_width = "match_parent"
                android:layout_height = "wrap_content">

            <ViewFlipper
                android:id = "@+id/view_flipper"
                android:layout_width = "match_parent"
                android:layout_height = "match_parent"
                android:visibility = "visible">

                <RelativeLayout
                    android:layout_width = "match_parent"
                    android:layout_height = "wrap_content"
                    android:background = "@color/grey_ee"
                    android:focusableInTouchMode = "true"
                    android:paddingBottom = "35dp">

                    <TextView
                        android:id = "@+id/error_container_text"
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:layout_centerHorizontal = "true"
                        android:layout_marginLeft = "15dp"
                        android:layout_marginRight = "15dp"
                        android:layout_marginTop = "20dp"
                        android:elevation = "1dp"
                        android:gravity = "center"
                        android:padding = "10dp"
                        />

                    <android.support.v7.widget.RecyclerView
                        android:id = "@+id/time_duration_recycler_view"
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:layout_below = "@+id/error_container_text"
                        android:layout_marginTop = "20dp" />

                    <android.support.v7.widget.RecyclerView
                        android:id = "@+id/hours_detail_recycler_view"
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                       android:layout_below = "@+id/time_duration_recycler_view"
                        android:layout_centerHorizontal = "true"
                        android:layout_marginTop = "25dp"
                        android:nestedScrollingEnabled = "false" />
                </RelativeLayout>

card_item.xml

<RelativeLayout
    android:id = "@+id/errors_and_notifications_container"
    android:layout_width = "match_parent"
    android:layout_height = "wrap_content"
    android:layout_below = "@id/divider_for_details"
    android:background = "@color/white"
    android:paddingTop = "15dp">

    <android.support.v7.widget.CardView
        android:id = "@+id/card_view_errors"
        android:layout_width = "match_parent"
        android:layout_height = "wrap_content"
        app:cardBackgroundColor = "@color/white"
        app:cardCornerRadius = "0dp"
        app:cardElevation = "0dp">

        <RelativeLayout
            android:id = "@+id/single_error_row"
            android:layout_width = "match_parent"
            android:layout_height = "wrap_content"
            android:layout_below = "@+id/details"
            android:layout_marginBottom = "15dp"
            android:orientation = "horizontal"
            android:paddingLeft = "15dp"
            android:paddingRight = "15dp">

            <ImageView
                android:id = "@+id/time_entry_error_image"
                android:layout_width = "15dp"
                android:layout_height = "15dp"
                android:layout_centerVertical = "true"
                android:layout_marginLeft = "5dp"
                android:src = "@drawable/error" />

            <TextView
                android:id = "@+id/single_error_text"
                android:layout_width = "wrap_content"
                android:layout_height = "wrap_content"
                android:layout_centerVertical = "true"
                android:layout_marginLeft = "45dp"/>
        </RelativeLayout>

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

    <android.support.v7.widget.CardView
        android:id = "@+id/card_view_notifications"
        android:layout_width = "match_parent"
        android:layout_height = "wrap_content"
        android:layout_below = "@id/card_view_errors"
        app:cardBackgroundColor = "@color/white"
        app:cardCornerRadius = "0dp"
        app:cardElevation = "0dp">

        <RelativeLayout
            android:id = "@+id/single_notification_row"
            android:layout_width = "match_parent"
            android:layout_height = "wrap_content"
            android:layout_marginBottom = "15dp"
            android:orientation = "horizontal"
            android:paddingLeft = "15dp"
            android:paddingRight = "15dp">

            <ImageView
                android:id = "@+id/time_entry_notification_image"
                android:layout_width = "15dp"
                android:layout_height = "15dp"
                android:layout_centerVertical = "true"
                android:layout_marginLeft = "5dp"
                android:src = "@drawable/information" />

            <TextView
                android:id = "@+id/single_notification_text"
                android:layout_width = "wrap_content"
                android:layout_height = "wrap_content"
                android:layout_centerVertical = "true"
                android:layout_marginLeft = "45dp"
                android:textColor = "@color/black_58"
             />
        </RelativeLayout>

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

</RelativeLayout>

Я также добавил Viewflipper. Это причина для этого? Вы можете видеть, что у первого XML есть два ресайклера-представления. Один работает нормально, потому что для этого представления ресайклера нет карт.

Покажи несколько кодов.

DKV 26.12.2018 08:37

Разместите соответствующий код

Piyush 26.12.2018 08:37
0
2
62
2

Ответы 2

однажды попробуй это,

recylerView.setHasFixedSize(true); 
recylerView.setNestedScrollingEnabled(false);

Не работает в моем случае

Priyadharshini 26.12.2018 08:57

закрыть recyclerview с горизонтальной прокруткой.

     LayoutManager layoutManager = new LinearLayoutManager(this,RecyclerView.VERTICAL,false) 
    {
         @override 
         public Boolean canScrollHorizontally(){

          return false;
          }
     }

     recyclerView.setLayout(layoutManager);

Другие вопросы по теме