Custom RecyclerView white space

0

I'm having trouble with my custom list and it has too much item space for the other

Following code

 <RelativeLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_margin="16dp">

     <TextView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center"
         android:text="@string/seusEquipamentos"
         android:textStyle="bold"/>


     <ImageView
         android:id="@+id/imgFecharModalProduto"
         android:src="@drawable/ic_fechar"
         android:layout_alignParentRight="true"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_centerVertical="true"
         android:layout_alignParentEnd="true"
         android:clickable="true"
         android:layout_marginEnd="18dp" />
 </RelativeLayout>


<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerListaProduto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="40dp"/>

Custom List

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

   <RelativeLayout
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:paddingLeft="25dp"
       android:paddingRight="25dp">
       <TextView
           android:id="@+id/txtDescricaoProduto"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="Descricao do item de estoque"/>

       <TextView
           android:id="@+id/txtUnidadeMedida"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="unidade"
           android:layout_alignParentRight="true"
           android:layout_alignRight="@id/txtDescricaoProduto"/>

       <TextView
           android:id="@+id/txtSerialQtd"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:paddingTop="20dp"
           android:text="Serial:12ddgf4489fsdfs" />

       <View
           android:id="@+id/linhaDivideProduto"
           android:layout_width="match_parent"
           android:layout_marginTop="40dp"
           android:layout_height="@dimen/list_divider"
           android:background="@color/divider" />
   </RelativeLayout>

</LinearLayout>

    
asked by anonymous 21.11.2017 / 18:13

1 answer

4

Your LinearLayout of the list xml is with height set to match_parent , it will use the total height of the parent element, so it is filling it in full. Try to use some fixed size as 30dp or wrap_content

    
21.11.2017 / 18:42