Custom Recyclerview Blanks

Asked

Viewed 254 times

0

I’m having trouble in my custom list is with too much blank item space for each other

Follows 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"/>

Customized 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>

inserir a descrição da imagem aqui

1 answer

4


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

  • I changed here in Linearlayout but still continued the same way.

  • Had changed the layout wrong, it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.