Есть такая разметка для элемента (т.е. пункта списка для RecyclerView)
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/item_all_side_padding">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/iconView"
android:layout_width="@dimen/item_icon_size"
android:layout_height="@dimen/item_icon_size"
android:layout_marginRight="@dimen/item_icon_margin_right"
android:adjustViewBounds="false"
android:background="@drawable/noimg"
android:scaleType="center"
app:riv_border_color="@color/cardview_shadow_start_color"
app:riv_border_width="4dp"
app:riv_mutate_background="true"
app:riv_oval="true" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/txtName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="1"
android:text="@string/txtName" />
<TextView
android:id="@+id/txtFamily"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="1"
android:text="@string/txtFamily" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
Мне нужно чтобы элементы в списке были разделены также как на картинке, т.е чтобы после каждого элемента была линия. Как это сделать?
ItemDecoration
вRecyclerView
. В sdk есть готовыйDividerItemDecoration
, но он рисует дивайдер на всю ширину. Для вашего случая нужно будет его вручную кастомизировать.