-3

Adicionei uma RecyclerView em dentro de uma DraweLayout, mas por algum motivo a rolagem do RecyclerView não funciona

acitivty_main.xml

<androidx.drawerlayout.widget.DrawerLayout
            android:id="@+id/drawer_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <LinearLayout
                android:layout_gravity="start"
                android:fitsSystemWindows="true"
                android:layout_width="match_parent"
                android:background="?android:attr/windowBackground"
                android:orientation="vertical"
                android:layout_height="match_parent">
                <include
                    layout="@layout/main_drawer_header"
                    android:background="?attr/colorPrimary"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">
                    <androidx.recyclerview.widget.RecyclerView
                        android:id="@+id/recycler_view"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:padding="4dp"
                        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
                </LinearLayout>
            </LinearLayout>
</androidx.drawerlayout.widget.DrawerLayout>

MainActivity

//A Lista vai conter os arquivo de um diretório, igual um "FileExplorer"
recyclerAdapter = new RecyclerAdapter(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + PATH);
recyclerView.setAdapter(recyclerAdapter);

2 Respostas 2

0

Na sua class Main, ja tentou colocar a orientação como VERTICAL?

`recyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));`
-1

Para resolver isso, basta colocar uma ScrollView antes da RecyclerView

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
       <androidx.recyclerview.widget.RecyclerView"
           android:layout_width="match_parent"
           android:layout_height="match_parent"/>
</ScrollView>

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .