LinearLayout с RecyclerView скрыть ImageView при прокрутке вне CardView

Я пытаюсь выполнить действие с recyclerview внутри cardview. Над карточным обзором есть изображение, которое я хочу, чтобы оно исчезало, когда я прокручиваю recyclerview, но не убираю голубое поле. Как я могу это сделать? Я пробовал с NestedScrollView, но без результатов

Актуальный макет

Вот мой код макета

<?xml version = "1.0" encoding = "utf-8"?>
     <RelativeLayout
          xmlns:android = "http://schemas.android.com/apk/res/android"
          xmlns:app = "http://schemas.android.com/apk/res-auto"
          xmlns:tools = "http://schemas.android.com/tools"
          android:layout_width = "match_parent"
          android:layout_height = "match_parent"
          android:transitionName = "itemMainTransition"
          tools:context = ".activity.WeatherActivity">
          <LinearLayout
              android:layout_width = "match_parent"
              android:layout_height = "match_parent"
              android:orientation = "vertical">

              <ImageView
                  android:id = "@+id/meteoTrentinoBanner"
                  android:background = "#42a4ce"
                  android:src = "@drawable/logo_meteotn"
                  android:layout_width = "match_parent"
                  android:layout_height = "wrap_content" />

              <android.support.v7.widget.CardView
                  android:layout_width = "match_parent"
                  android:layout_height = "wrap_content"
                  android:layout_marginEnd = "5dp"
                  android:layout_marginStart = "5dp"
                  app:cardCornerRadius = "5dp"
                  app:cardElevation = "5dp"
                  app:cardUseCompatPadding = "true">

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

                 <LinearLayout
                     android:layout_width = "match_parent"
                     android:layout_height = "55dp"
                     android:orientation = "horizontal"
                     android:background = "@drawable/weather_border">

                     <ImageView
                         android:id = "@+id/backDay"
                         android:layout_width = "70dp"
                         android:layout_height = "match_parent"
                         android:layout_gravity = "center_vertical"
                         android:src = "@drawable/ic_back"/>
                     <LinearLayout
                         android:layout_width = "0dp"
                         android:layout_height = "match_parent"
                         android:layout_weight = "1"
                         android:orientation = "horizontal">
                         <TextView
                             android:id = "@+id/textViewMinTemp"
                             android:layout_width = "40dp"
                             android:layout_height = "match_parent"
                             android:textAlignment = "center"
                             android:gravity = "center_vertical|center_horizontal"
                             android:textSize = "19sp"
                             android:textStyle = "bold"
                             android:textColor = "#0000FF"/>
                         <TextView
                             android:id = "@+id/textViewDay"
                             android:text = "@string/oggi"
                             android:layout_width = "0dp"
                             android:layout_height = "match_parent"
                             android:layout_weight = "1"
                             android:gravity = "center_vertical"
                             android:textAlignment = "center"
                             android:textSize = "25sp"
                             android:textStyle = "bold"
                             tools:ignore = "NestedWeights" />
                         <TextView
                             android:id = "@+id/textViewMaxTemp"
                             android:layout_width = "40dp"
                             android:layout_height = "match_parent"
                             android:textAlignment = "center"
                             android:gravity = "center_vertical|center_horizontal"
                             android:textSize = "19sp"
                             android:textStyle = "bold"
                             android:textColor = "#FF0000"/>
                     </LinearLayout>

                     <ImageView
                         android:id = "@+id/forwardDay"
                         android:layout_width = "70dp"
                         android:layout_height = "match_parent"
                         android:layout_gravity = "center_vertical"
                         android:src = "@drawable/ic_forward"/>
                 </LinearLayout>

                 <LinearLayout
                     android:layout_width = "match_parent"
                     android:layout_height = "55dp"
                     android:orientation = "horizontal"
                     android:background = "@drawable/weather_border">
                     <ImageView
                         android:id = "@+id/meteoInfo"
                         android:layout_width = "40dp"
                         android:layout_height = "match_parent"
                         android:src = "@drawable/ic_info"/>

                     <TextView
                         android:id = "@+id/textViewWeather"
                         android:textSize = "23sp"
                         android:layout_width = "match_parent"
                         android:layout_height = "match_parent"
                         android:gravity = "center_vertical"
                         android:singleLine = "true"
                         android:ellipsize = "marquee"
                         android:marqueeRepeatLimit = "marquee_forever"
                         android:focusable = "true"
                         android:focusableInTouchMode = "true"
                         android:scrollHorizontally = "true"/>
                 </LinearLayout>
                <android.support.v7.widget.RecyclerView
                    android:id = "@+id/recyclerViewMeteo"
                    android:layout_width = "match_parent"
                    android:layout_height = "wrap_content">
                </android.support.v7.widget.RecyclerView>
            </LinearLayout>
        </android.support.v7.widget.CardView>
    </LinearLayout>
</RelativeLayout>

ваш вид ресайклера должен прокручиваться по синему окну или нет?

Jay Thummar 25.05.2018 11:44

нет, синяя рамка должна быть видна всегда, изображение должно исчезать при прокрутке recyclerview. вид карты должен переводиться вверх, скрывая изображение

Dennis 25.05.2018 11:47

каково поведение сейчас?

Suhaib Roomy 25.05.2018 11:58

на данный момент изображение и коробка исправлены, и прокручивается только recyclerview

Dennis 25.05.2018 12:00
1
4
681
0

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