Recyclerview不包含我的所有内容,但限制自己的屏幕高度

时间:2016-11-27 22:35:54

标签: android android-recyclerview recycler-adapter

我遇到了一些问题,当我在里面填充它时,试图让我的recyclerview我的整个文本,但它似乎专注于使用的手机的屏幕高度,因此我的一些文本丢失。我怎样才能让它们全部存在。

show partly of the text

布局回收者持有人查看代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.CardView
    android:id="@+id/card_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    card_view:cardCornerRadius="4dp"
    android:layout_margin="6dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="8dp"
        android:paddingLeft="16dp"
        android:paddingRight="16dp"
        android:paddingTop="8dp"
        android:orientation="vertical">

        <TextView
            android:id="@+id/txtDate"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="@style/TextAppearance.AppCompat"
            tools:text="D"
            android:textSize="16sp"
            android:textStyle="normal|bold" />

</linear.......................

RecyclerBox布局就像这些

 <LinearLayout

        android:id="@+id/fragmentContainer"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="match_parent"
        android:focusableInTouchMode="true"
        android:focusable="true">

        <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/recycleNView">

        </android.support.v7.widget.RecyclerView>

    </LinearLayout>

1 个答案:

答案 0 :(得分:0)

视图持有者中的根LinearLayout具有

android:layout_height="match_parent"

这将使每一行与RecyclerView的高度相匹配,无论其内容如何。

将其更改为wrap_content,它应该可以正常工作。