3

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!

one_man
  • 135
  • 2
  • 14
  • Please post the relevant layout snippet, so people don't have to download your archive first. It will greatly improve your chances of getting an answer. – ByteWelder Sep 12 '15 at 20:27
  • @one_man did you solve it.? – mfaisalhyder Feb 06 '16 at 08:04
  • @MFaisalHyder yap ^) – one_man Feb 06 '16 at 10:06
  • @one_man kindly share how, it is frustrating that other apps of mine are not showing this thing but current one is doing it, with cardCornerRadius=5dp my three apps are working fine with same layout but this one is , grrr.!! kindly share the solution.! – mfaisalhyder Feb 06 '16 at 10:23
  • @one_man i think if you like my other question, i'll can help you :)) http://stackoverflow.com/questions/33639314/runtimeexception-in-one-case-nullexeption-getbackstackcount http://stackoverflow.com/questions/33649056/realize-back-arrow-with-help-basefragment http://stackoverflow.com/questions/34138947/recyclerview-save-elements-in-json http://stackoverflow.com/questions/34240755/save-alarm-after-app-killing http://stackoverflow.com/questions/35011428/trouble-with-parse-com-and-space-apostrophe http://stackoverflow.com/questions/35071861/dont-work-post-query – one_man Feb 06 '16 at 12:43
  • @MFaisalHyder i just change backgroung, and all work – one_man Feb 07 '16 at 22:56

2 Answers2

1

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

-1

Try this -

android:divider="@null"

Or from your code -

getListView().setDivider(null);
getListView().setDividerHeight(0);
Techidiot
  • 1,921
  • 1
  • 15
  • 28
  • I use RecycleView. The RecyclerView class has no divider-related parameters. – one_man Sep 12 '15 at 20:51
  • You posted your code later. Your original post says CardView. You need decorator in that case. Try this http://stackoverflow.com/questions/28713231/recyclerview-item-separator – Techidiot Sep 12 '15 at 21:18
  • CardView inside RecycleView – one_man Sep 12 '15 at 21:28
  • That's a default behavior of the Card-view inside recyclerview in pre-lollipop versions. Check this link http://stackoverflow.com/questions/30420869/cardview-and-recyclerview-divider-behaviour As I said, you can just play around with the backgrounds and attributes of your card-view. – Techidiot Sep 12 '15 at 21:43