2016-11-27 26 views
0

我有問題試圖讓我的回收看房子我的整個文本,當我填充它們裏面,但它似乎專注於使用手機的屏幕高度,因此一些我的文本丟失了。我怎麼能把它們全部放在一起。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> 
+0

從'LinearLayout'中移除'RecyclerView'。 –

+0

將RecyclerView高度更改爲「match_parent」 –

+0

感謝@Rachana,工作完美。 – Cistem

回答

0

在視圖支架根LinearLayout具有

android:layout_height="match_parent" 

這將使每行匹配RecyclerView的高度,無論其內容如何。

將其更改爲wrap_content,它應該可以正常工作。

+0

謝謝你的解釋,現在我明白了。很感謝@Benito Bertoli – Cistem

相關問題