[英]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.