GUJ Discussões   :   últimos tópicos   |   categorias   |   GUJ Respostas

RecyclerView

java
android
firebase
Tags: #<Tag:0x00007f97257a32f8> #<Tag:0x00007f97257a31b8> #<Tag:0x00007f97257a3078>

#1

Tenho uma Recyclerview dentro de um NestedScrollView e gostaria que quando for rolada para cima ela ocupe e tela inteira(esse comportamento https://i.imgur.com/KzAd6pR.gifv ) mas, so consigo ter esse comportamento deixando a RecyclerView sem tamanho fixo( setHasFixedSize(false); ) e com NestedScroll desativado ( setNestedScrollingEnabled(false); ) mas isso faz com que a recyclerview sempre chame o onCreateViewHolder e nao reaproveite as views.
Gostaria de saber se tem outra forma de chegar nesse resultado?
Comportamento com tamanho fixo e NestedScroll ativado( https://i.imgur.com/zTztYUv.gifv )

Layout:

<android.support.design.widget.CoordinatorLayout 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.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:elevation="4dp"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="64dp"
        app:contentInsetStart="0dp"
        app:layout_scrollFlags="scroll|enterAlways">

        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ImageButton
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:layout_marginEnd="16dp"
                android:layout_marginTop="8dp"
                android:onClick="LoginActivity"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:text="Bem vindo "
                android:textAlignment="viewStart"
                android:textSize="18sp"
                android:textStyle="bold"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

        </android.support.constraint.ConstraintLayout>
    </android.support.v7.widget.Toolbar>

    <SearchView
        android:layout_width="match_parent"
        android:layout_height="88dp"
        android:id="@+id/search_view"
        />

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

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

        <ImageButton
            android:id="@+id/iv_button_ad"
            android:layout_width="match_parent"
            android:layout_height="124dp"
            android:layout_margin="16dp" />

        <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="108dp"
            android:clipToPadding="false"
            android:orientation="horizontal"
            android:paddingLeft="16dp" />

        <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" />
    </LinearLayout>


</android.support.v4.widget.NestedScrollView>

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