Skip to content
Advertisement

Gray line inside cardview :)?

How do I remove the gray line (you can see on the screen) at the bottom of CardView? Android screenshot

Archive with source-code

I reviewed everything. I don’t understand what the problem is.

<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout">
        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="contact det"
            android:gravity="center_vertical"
            android:textColor="@android:color/background_dark"
            android:textSize="14dp"
            android:layout_gravity="center_horizontal"/>
    </LinearLayout>
    <View
    android:layout_height="1dp"
    android:layout_width="match_parent"
    android:background="@color/accent"
    android:layout_below="@+id/linearLayout"/>
    <TextView
        android:id="@+id/txtName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Name"
        android:gravity="center_vertical"
        android:textSize="10dp"
        android:layout_below="@+id/linearLayout"
        android:layout_alignLeft="@+id/txtSurname"
        android:layout_alignStart="@+id/txtSurname"/>
    <TextView
        android:id="@+id/txtSurname"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Surname"
        android:gravity="center_vertical"
        android:textSize="10dp"
        android:layout_below="@+id/txtName"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"/>
    <TextView
        android:id="@+id/txtEmail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Email"
        android:textSize="10dp"
        android:layout_above="@+id/txtAdd"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"/>
    <TextView
        android:id="@+id/txtAdd"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Address"
        android:textSize="10dp"
        android:layout_alignTop="@+id/txtSurname"
        android:layout_alignLeft="@+id/txtEmail"
        android:layout_alignStart="@+id/txtEmail"/>
</RelativeLayout>

Its my item CardView.

when

    card_view:cardCornerRadius="2dp"

all is good, but when I write another value and line appears!

Advertisement

Answer

Just use “com.google.android.material.card.MaterialCardView” it will avoid issues connected to CardView

Advertisement