Android card has a thin gray line between cards

I have an Android List that shows a map view, and as you can see in this illustration, there is a thin gray line between my cards:

enter image description here

How can I get rid of the gray line?

My xml for this kind of map is as follows:

<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="6dp" android:layout_marginRight="6dp" android:layout_marginTop="4dp" android:layout_marginBottom="4dp" android:orientation="vertical" android:background="@drawable/bg_card"> <!-- Card Contents go here --> <TextView android:id="@+id/beerNameList" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/beerBreweryNameList" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" /> </LinearLayout> </FrameLayout> 

bg_card.xml:

 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle" android:dither="true"> <corners android:radius="2dp"/> <solid android:color="#ccc" /> </shape> </item> <item android:bottom="2dp"> <shape android:shape="rectangle" android:dither="true"> <corners android:radius="2dp" /> <solid android:color="@android:color/white" /> <padding android:bottom="8dp" android:left="8dp" android:right="8dp" android:top="8dp" /> </shape> </item> </layer-list> 

Tried changing the height of the separator, here is my code that he did not get rid of the gray line:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" tools:context=".MainActivity" > <LinearLayout android:id="@+id/linlaHeaderProgress" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:orientation="vertical" android:visibility="gone" > <ProgressBar android:id="@+id/pbHeaderProgress" style=" android@style /Spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" > </ProgressBar> </LinearLayout> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:dividerHeight="0px" > </ListView> </LinearLayout> 
+6
source share
5 answers

dividerHeight should work. As a workaround, you can change the separator color to background color or transparent color

 <ListView android:id="@+id/android:list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:divider="#E6E6E6" android:dividerHeight="0px"/> 

You can also try this trick:

  android:divider="@null" 
+16
source

I definitely had a problem. None of the XML affected the list result. Instead, as mentioned in a Quanturium comment, I went to my ListFragment onActivityCreated and added -

 getListView().setDivider(null); getListView().setDividerHeight(0); 

Hope this helps!

+4
source

It looks like you are using listview, try setting this parameter in android:dividerHeight="0px" listView android:dividerHeight="0px"

0
source

It looks like you are using listview, and this XML is a list. The gray line is the list separator. Set it to zero, like this android: dividerHeight = "0dp" for the list.

0
source

I need to put

divierHeight = 0px

and the color chage equal to the color backgroud, in this case

 android:divider="#FFFFFF" 
 <ListView android:id="@+id/lv" android:layout_width="match_parent" android:layout_height="wrap_content" android:dividerHeight="0px" android:divider="#FFFFFF" /> 
0
source

Source: https://habr.com/ru/post/953598/


All Articles