简体   繁体   English

如何修复仅显示单行的android的回收视图视图问题

[英]How do I fix android's recycler view rendering issue which only displays single rows

I recently started getting this issue on an app I am working on android. 我最近开始在正在使用android的应用程序上遇到此问题。 It suddenly started rendering single rows on the page. 它突然开始在页面上呈现单行。 A new row gets displayed only as the previous row scrolls out of the screen. 仅当前一行滚动出屏幕时,才会显示新行。 Here's an example. 这是一个例子。 Any help is appreciated. 任何帮助表示赞赏。

Add wrap_content to the layout height to the parent layout that holds cardview. 将wrap_content添加到拥有cardview的父版式的版式高度。 it will solve the problem. 它将解决问题。 here is some snippet that will help you. 这是一些可以帮助您的代码段。

 <LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="match_parent" >

 <android.support.v7.widget.CardView
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/quote_card"
    android:layout_height="200dp"
    android:layout_width="match_parent"
    card_view:cardBackgroundColor="#666"
    card_view:cardCornerRadius="5dp"
    card_view:cardElevation="5dp"
    app:cardUseCompatPadding="true"
    >

   //other views here


</android.support.v7.widget.CardView>
</LinearLayout>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Android Studio 的回收站视图中删除特定文件? - How do I delete a specific file in recycler view of Android Studio? 如何检索已存储在firebase数据库中并显示在回收站视图中的图像? - How do I retrieve the images which have been stored in the firebase database and show in the recycler view? 我想将一些物品发送到第二个活动的回收站视图。 我怎么能用房间做到这一点 - I want to send some items to second activity's recycler view. How can I do it with Room 如何在回收者视图的单个项目中更新视图 - how to update view in a single item of recycler view 如何在回收站视图中只获取我想要的项目 - how can get only item that I wanted in recycler view Android Recycler视图切换按钮回收问题 - Android recycler view toggle button recycling issue 如何通过 android 中的回收器视图运行 for 循环? - How can I run a for loop through a recycler view in android? 如何解决 Android Studio 中重叠组件的问题? - How do I fix issue on overlapping components in Android Studio? Android Studio:如何解决我的 AVD 终止问题? - Android Studio: How do I fix my AVD termination issue? 如何将我的 API JSON 数据显示到回收站视图中 - How do I display my API JSON data into a recycler view
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM