Cómo establecer el color en el lado de cardview

Dioptrías Pico:

Estoy tratando de comprender lo que es la mejor forma de conjunto de colores en el lado de una CardView como esto

introducir descripción de la imagen aquí

Mi cardview se ve así:

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:id="@+id/cardViewWe"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="4dp"
android:foreground="?attr/selectableItemBackground"
android:transitionName="cardTransition"
app:cardBackgroundColor="@drawable/selector"
app:cardElevation="2dp"

card_view:cardCornerRadius="8dp">

  <androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 .....
 .....
   </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
Nilesh Rathod:

Trate de esta manera

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    app:cardCornerRadius="10dp"
    app:cardElevation="2dp"
    app:cardUseCompatPadding="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/white"
        android:orientation="horizontal">

        <View
            android:layout_width="5dp"
            android:layout_height="match_parent"
            android:background="@color/colorAccent" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical"
            android:padding="10dp">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Nilesh Rathod" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Nilesh Rathod" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Nilesh Rathod" />

        </LinearLayout>
    </LinearLayout>


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

SALIDA

introducir descripción de la imagen aquí

Supongo que te gusta

Origin http://43.154.161.224:23101/article/api/json?id=201045&siteId=1
Recomendado
Clasificación