2017-02-16 4 views
2

私はうまく動作している私のアプリでandroid-recyclerviewを追加しました。私のレイアウトによると、私はセル間の除算器を削除する必要があります。リストビューでは、以下のようにdividerプロパティをnullに設定することで簡単に実現できますが、android-recyclerviewではそのようなプロパティを見つけることができません。どうすればこれをandroid-recyclerviewで達成できますか?recylerviewからデフォルトの仕切りを削除するには

getListView().setDivider(null); 
getListView().setDividerHeight(0); 
    OR 
android:divider="@null" 
android:dividerHeight="0dp" 

以下RecylerviewのXML:

<android.support.v7.widget.RecyclerView 
       android:id="@+id/recycler_view_contact_list_frag" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_weight="0.8" 
       android:clickable="true" 
       android:focusable="true" 
       android:scrollbars="vertical" /> 

アダプタのxml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
android:background="@drawable/recyclerview_item_borders" 
android:padding="10dp"> 

<LinearLayout 
    android:id="@+id/section_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:visibility="gone" 
    android:paddingBottom="30dp" 
    > 


<TextView 
    android:id="@+id/textview_section_header" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    /> 

</LinearLayout> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    > 
    <de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/circular_image_contact" 
     android:layout_width="@dimen/auto_complete_circular_image_dimen" 
     android:layout_height="@dimen/auto_complete_circular_image_dimen" 
     app:civ_border_color="#FF000000" 
     android:layout_weight="0.2" 
     android:src="@mipmap/ic_default_contact" 
     app:civ_border_width="0dp" /> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_weight="0.8" 
     android:orientation="vertical"> 

     <TextView 
      android:id="@+id/textView_contact_name" 
      android:layout_width="match_parent" 
      android:layout_gravity="center_vertical" 
      android:gravity="center_vertical" 
      android:layout_marginLeft="@dimen/activity_horizontal_margin" 
      android:textColor="@color/textDarkColor" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" /> 

     <TextView 
      android:id="@+id/textView_contact_number" 
      android:layout_width="match_parent" 
      android:layout_gravity="center_vertical" 
      android:gravity="center_vertical" 
      android:layout_marginLeft="@dimen/activity_horizontal_margin" 
      android:textColor="@color/textDarkColor" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" /> 


    </LinearLayout> 
</LinearLayout> 

+7

Recyclerviewはデフォルト – raktale

+0

セットのアンドロイドによって何の分周器を持っていません。 –

+0

@SorathiyaPayal Recylerviewに仕切りはありません!このリンクを参照してくださいhttps://developer.android.com/reference/android/support/v7/widget/RecyclerView.html – raktale

答えて

0

Recyclerviewは、デフォルトでは分周器を持っていません。ディバイダを追加する必要がある場合は、recyclerviewに装飾を追加する必要があります。

0

デフォルトでは使用しているカスタムビューからのもので、ディバイダはありません。誰もあなたを助けることができるあなたのコードを共有してください。

1

あなたはリストアイテムビューでそれを変更する必要があるアダプタ

android:background="@drawable/recyclerview_item_borders" 
0

から背景を削除します。リスト項目ビューに以下のパラメータを追加します。

card_view:cardCornerRadius="0dp" 
card_view:cardElevation="0dp" 
card_view:cardUseCompatPadding="true" 
list_item_view.xmlで

<android.support.v7.widget.CardView 
    android:id="@+id/card_view" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center" 
    card_view:cardCornerRadius="0dp" 
    card_view:cardElevation="0dp" 
    card_view:cardUseCompatPadding="true"> 

は、その前景色にあなたのリサイクルビューの背景色を設定します。あなたのxmlファイルにdividerHeight = "0dp":それは白の場合、recycle_view.xmlで

<android.support.v7.widget.RecyclerView 
    android:id="@+id/recycler_view" 
    android:layout_width="match_parent" 
    android:background="#ffffff" 
    android:scrollbars="vertical" 
    android:layout_height="wrap_content"/> 
関連する問題