2017-08-22 10 views
1

すべての親アイテムが子アイテムを持つように異なるビューを持つ拡張可能なRecyclerViewを作成しました親アイテムを展開するときは私の場合は子アイテムの間に垂直方向の間隔を入れて表示します enter image description here親アイテムを展開するときの子アイテムの間隔

これは私のメインのXMLファイルであるとして

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="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:background="#dedede" 
     tools:context="abtech.waiteriano.com.waitrer.MainPaymentActivity"> 

     <RelativeLayout 
      android:id="@+id/relativeLayout2" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentStart="true" 
      android:layout_alignParentTop="true" 
      android:layout_marginTop="19dp" 
      android:background="#ffffff"> 

      <EditText 
       android:id="@+id/checkNoET" 
       android:layout_width="140dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentTop="true" 
       android:layout_toEndOf="@+id/imageView7" 
       android:editable="false" 
       android:ems="10" 
       android:gravity="right" 
       android:text="505050505050" 
       android:textSize="12dp"> 

       <requestFocus /> 
      </EditText> 

      <TextView 
       android:id="@+id/checkNo" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignBaseline="@+id/checkNoET" 
       android:layout_alignBottom="@+id/checkNoET" 
       android:layout_marginStart="10dp" 
       android:layout_toEndOf="@+id/imageView7" 
       android:text="Check#" 
       android:textColor="@color/colorPrimary" 
       android:textSize="12dp" 
       android:textStyle="bold" /> 

      <ImageView 
       android:id="@+id/imageView7" 
       android:layout_width="25dp" 
       android:layout_height="wrap_content" 
       android:layout_alignBottom="@+id/checkNoET" 
       android:layout_alignParentStart="true" 
       android:layout_alignTop="@+id/checkNoET" 
       app:srcCompat="@drawable/check" /> 

      <EditText 
       android:id="@+id/editText" 
       android:layout_width="130dp" 
       android:layout_height="wrap_content" 
       android:layout_alignBaseline="@+id/checkNoET" 
       android:layout_alignBottom="@+id/checkNoET" 
       android:layout_alignParentEnd="true" 
       android:editable="false" 
       android:ems="10" 
       android:gravity="end" 
       android:text="5" 
       android:textSize="12dp"> 

       <requestFocus /> 
      </EditText> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignBaseline="@+id/editText" 
       android:layout_alignBottom="@+id/editText" 
       android:layout_alignStart="@+id/editText" 
       android:layout_marginStart="13dp" 
       android:text="Coves" 
       android:textColor="@color/colorPrimary" 
       android:textSize="12dp" 
       android:textStyle="bold" /> 


      <ImageView 
       android:id="@+id/imageView8" 
       android:layout_width="25dp" 
       android:layout_height="wrap_content" 
       android:layout_alignBottom="@+id/editText" 
       android:layout_toStartOf="@+id/editText" 
       app:srcCompat="@drawable/covers" /> 

      <EditText 
       android:id="@+id/tableNo" 
       android:layout_width="130dp" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/checkNoET" 
       android:layout_toEndOf="@+id/imageView7" 
       android:editable="false" 
       android:ems="10" 
       android:gravity="end" 
       android:text="25" 
       android:textSize="12dp"> 

       <requestFocus /> 
      </EditText> 

      <TextView 
       android:id="@+id/textView13" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignBaseline="@+id/tableNo" 
       android:layout_alignBottom="@+id/tableNo" 
       android:layout_alignStart="@+id/checkNo" 
       android:text="Table" 
       android:textColor="@color/colorPrimary" 
       android:textSize="12dp" 
       android:textStyle="bold" /> 

      <ImageView 
       android:id="@+id/imageView9" 
       android:layout_width="25dp" 
       android:layout_height="wrap_content" 
       android:layout_alignParentStart="true" 
       android:layout_below="@+id/checkNoET" 
       app:srcCompat="@drawable/tablepay" /> 

      <EditText 
       android:id="@+id/editText14" 
       android:layout_width="130dp" 
       android:layout_height="wrap_content" 
       android:layout_alignBaseline="@+id/tableNo" 
       android:layout_alignBottom="@+id/tableNo" 
       android:layout_alignParentEnd="true" 
       android:editable="false" 
       android:text="15/10/2017 03:15PM" 
       android:textColor="#000000" 
       android:textSize="10dp" 
       android:textStyle="bold" /> 

      <ImageView 
       android:id="@+id/imageView10" 
       android:layout_width="25dp" 
       android:layout_height="wrap_content" 

       android:layout_alignBottom="@+id/editText14" 
       android:layout_toStartOf="@+id/editText14" 
       app:srcCompat="@drawable/calendar" /> 
     </RelativeLayout> 

     <RelativeLayout 
      android:id="@+id/relativeLayout3" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentStart="true" 
      android:layout_below="@+id/relativeLayout2" 
      android:layout_marginTop="14dp" 
      android:background="#ffffff"> 

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

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="220dp" 
      android:layout_below="@+id/relativeLayout3" 
      android:layout_marginTop="10dp" 
      android:background="#ffffff"> 

      <GridView 
       android:id="@+id/paymentsTypeGV" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:columnWidth="80dp" 
       android:gravity="center" 
       android:horizontalSpacing="5dp" 
       android:numColumns="4" 
       android:stretchMode="columnWidth" 
       android:verticalSpacing="5dp"></GridView> 
     </RelativeLayout> 
    </RelativeLayout> 

私の問題は私のxmlの設計からのものであり、私はXMLからであれば問題は子リストの項目をotの親リスト項目にあるか、またはメインから設計XMLファイルは、何かが不明な場合は申し訳ありません

答えて

1

考えてみましょう:テキスト要素のすべてのパディングを削除してみてください。これが動作する場合

android:includeFontPadding="false" 

、この答えはに重複になるだろう:たくさんご興味のため

Android: TextView: Remove spacing and padding on top and bottom

+1

おかげで私はそれが動作しないのファイルXMLでrecyclerViewでこれを入れてみました – Nativony

関連する問題