[英]How to remove the line that appears under each card in card view?
I have a problem with the line that appears under each card as shown in this picture.我对出现在每张卡片下方的线条有问题,如图所示。 Is there any way to remove it, or is it not possible?
有没有办法去除它,或者是不可能的?
Also, how can I present each card with a different color for example (purple and yellow)?另外,我怎样才能用不同的颜色呈现每张卡片(例如紫色和黄色)?
This is my code这是我的代码
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
tools:context=".benReqView">
<Button
android:id="@+id/button15"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@drawable/chat2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.6"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.977" />
<Button
android:id="@+id/benReqback"
android:layout_width="25dp"
android:layout_height="22dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"
android:background="@drawable/leftarrow"
app:layout_constraintBottom_toTopOf="@+id/signupDon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.021"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.073" />
<TextView
android:id="@+id/benReqEmpty"
android:layout_width="150dp"
android:layout_height="23dp"
android:layout_marginStart="20dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="20dp"
android:text=""
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.086" />
<ListView
android:id="@+id/benReqListView"
android:layout_width="401dp"
android:layout_height="539dp"
android:layout_marginBottom="2dp"
android:background="#fafafa"
app:layout_constraintBottom_toTopOf="@+id/imageView8"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
</ListView>
<TextView
android:id="@+id/textView23"
android:layout_width="136dp"
android:layout_height="24dp"
android:fontFamily="@font/tajawalmedium2"
android:text="حالة الطلبات"
android:textAlignment="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.022" />
<ImageView
android:id="@+id/imageView8"
android:layout_width="414dp"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="@drawable/footer" />
<Button
android:id="@+id/benReqToprofile"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@drawable/userr"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.82"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.977" />
<Button
android:id="@+id/benReqToHomeicon"
android:layout_width="37dp"
android:layout_height="37dp"
android:background="@drawable/home"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.17"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.988" />
<Button
android:id="@+id/benReq"
android:layout_width="39dp"
android:layout_height="40dp"
android:background="@drawable/request"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.38"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.981" />
</androidx.constraintlayout.widget.ConstraintLayout>
I suspect that the line you're talking about is the ListView
's background appearing between your cards.我怀疑您正在谈论的那条线是
ListView
的背景出现在您的卡片之间。 Try removing this line: android:background="#fafafa"
尝试删除这一行:
android:background="#fafafa"
By the way, I suggest you to use a RecyclerView
instead of ListView
顺便说一句,我建议你使用
RecyclerView
而不是ListView
You can remove the ListView
's dividers by setting the divider's height to 0dp.您可以通过将分隔线的高度设置为 0dp 来移除
ListView
的分隔线。 Add the following lines to your ListView
: ListView
添加到您的ListView
:
android:dividerHeight="0dp"
android:divider="@null"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.