首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RecycleView不滚动

RecycleView不滚动
EN

Stack Overflow用户
提问于 2020-03-28 13:23:45
回答 1查看 29关注 0票数 0

在互联网上怒目而视似乎有很多原因,但我解决不了我的问题。我不能滚动我的RecyclerView,我完全不知道为什么。我的recyclerView包含在另一个布局中(activity_class.xml)

这是我的布局代码:

content_home_screen.xml

代码语言:javascript
复制
<?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

代码语言:javascript
复制
<?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>

任何想法,因为我几乎什么都试过了。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-28 15:38:46

将其添加到content_home_screen布局中

代码语言:javascript
复制
android:scrollbars="vertical" 
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60901718

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档