Reputation: 449
I have added android-recyclerview in my app which is running fine. According to my layout i have to remove divider between cells. In list view this can easily be achieved by setting divider property to null like below in code but i am not able to find any such property in android-recyclerview. How can i achieve this in android-recyclerview.
getListView().setDivider(null);
getListView().setDividerHeight(0);
OR
android:divider="@null"
android:dividerHeight="0dp"
Recylerview xml below :
<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" />
Adapter 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>
Upvotes: 2
Views: 5478
Reputation: 3107
You need to change it in the List item view. Add following parameters to list item view.
card_view:cardCornerRadius="0dp"
card_view:cardElevation="0dp"
card_view:cardUseCompatPadding="true"
In 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">
Then set background color of your Recycle view to its foreground color. If it is white,
In 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"/>
Upvotes: 0
Reputation: 3348
Remove background from adapter
android:background="@drawable/recyclerview_item_borders"
Upvotes: 1
Reputation: 1
It is from the custom view you are using by default there is no divider. share your code thn any one can help you.
Upvotes: 0
Reputation: 689
Recyclerview don't have the divider by default. If you need to add the divider, you have to add the decoration to the recyclerview.
Upvotes: 0