Reputation: 45
I am new in android app development.I am making a project in android-studio. I want to set color of listview as white and divider line's color as same as background image.My code is below
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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="@android:color/transparent"
tools:context="com.example.litifer.litiferdemo.MainActivity">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/imageView"
android:src="@drawable/images1"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView</android.support.constraint.ConstraintLayout>
list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_margin="@dimen/cardview_default_radius"
android:layout_width="match_parent"
android:background="#FFFFFF"
android:layout_height="wrap_content"></android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textViewHead"
android:text="Heading"
android:textSize="20dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="60dp"
android:layout_marginRight="40dp"
android:textAppearance="@android:style/TextAppearance.Large"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textViewDesc"
android:layout_marginTop="10dp"
android:layout_marginLeft="60dp"
android:layout_marginRight="40dp"
android:text="Description"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="60dp"
android:layout_marginRight="40dp"
android:id="@+id/textViewDate"
android:text="Date"/>
</LinearLayout></LinearLayout>
Upvotes: 0
Views: 1988
Reputation: 480
you can do using itemdecoration like as link attached link
or
you can add view at last to your layout
<View
android:layout_width="match_parent"
android:layout_height="@dimen/normal_margin1"
android:layout_marginTop="@dimen/normal_margin8"
android:background="@color/black12" />
Upvotes: 1