Cardview in API 10

Asked

Viewed 137 times

0

With normal background:

img fundo branco

When changing to another color, a line below the Textview: img fundo preto

xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    tools:context=".MainActivity">

    <android.support.v7.widget.CardView
        card_view:cardBackgroundColor="#18d018"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        card_view:cardCornerRadius="4dp">

        <LinearLayout
            android:padding="5dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:textSize="17sp"
                android:textStyle="bold"
                android:textColor="#fff"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:lines="1"
                android:ellipsize="end"
                android:gravity="center"
                android:text="Titulo de exemplo"/>

        </LinearLayout>

    </android.support.v7.widget.CardView>

</RelativeLayout>
  • What is the problem you are having? It is the line that is set in the second image?

  • Yeah, that’s right, that’s right.

1 answer

0

You need to set the divisor to 0, so that you don’t have this line at the bottom of each cardView, this can be used both to assemble a list with the "cards" as well as individually.

    <ListView 
    android:id="@+id/android:list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:divider="#E6E6E6"
    android:dividerHeight="0px"/>
  • tried and didn’t work

Browser other questions tagged

You are not signed in. Login or sign up in order to post.