ant*_*tsa 0 xml android view android-recyclerview
I need to make a little white line under my every recycler view item (from left to right corner), not for any particular element in that item, but for the whole item. (that way it's easier for a user to see which elements are in this particular item, and where another item starts)
Here is my item layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.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:layout_marginTop="@dimen/_5sdp"
app:cardCornerRadius="0dp"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark">
<TextView
android:id="@+id/nameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mike"
android:textColor="@color/colorAccent"
android:textSize="@dimen/_21sdp" />
<ImageView
android:id="@+id/image_delete"
android:layout_width="@dimen/_27sdp"
android:layout_height="@dimen/_27sdp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="@dimen/_4sdp"
android:background="@drawable/ic_delete" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
Run Code Online (Sandbox Code Playgroud)
For you item_layout.xml you can use View attribute:
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/whiteColor" />
Run Code Online (Sandbox Code Playgroud)
OR directly with recyclerview
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),layoutManager.getOrientation());
recyclerView.addItemDecoration(dividerItemDecoration);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
120 次 |
| 最近记录: |