RecycleView не прокручивает - PullRequest
0 голосов
/ 28 марта 2020

теребил inte rnet, кажется, это происходит по многим причинам, но я не могу решить свою. Я не могу прокрутить свой RecyclerView и совершенно не знаю почему. Мой recyclerView включен в другой макет (activity_class. xml)

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

content_home_screen. xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView 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:id="@+id/recyclerview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFF"
    tools:context="com.example.schoolteacher.ClassActivity"
    tools:showIn="@layout/activity_class">

</androidx.recyclerview.widget.RecyclerView>

Activity_class. xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.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"
    tools:context="com.example.schoolteacher.ClassActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/appBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="#FFFFFF"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            app:title="@string/classes"/>

    </com.google.android.material.appbar.AppBarLayout>

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

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/fab_margin"
        android:layout_marginBottom="70dp"
        android:src="@drawable/ic_add_fab"
        android:theme="@style/Theme.AppCompat"
        app:backgroundTint="@color/colorPrimary" />

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="?android:attr/windowBackground"
        app:menu="@menu/bottombar_menu" />


</androidx.coordinatorlayout.widget.CoordinatorLayout>

Любые идеи, потому что я попробовал почти все.

1 Ответ

2 голосов
/ 28 марта 2020

Добавьте это к content_home_screen layout

android:scrollbars="vertical" 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...