CardView BackgroundColor

У меня есть CardView, чей фон @color/clolor_ffffffно на телефоне фон карты выглядит серым...??!!

Я использовал xml-коды cardView на другой Деятельности, и это нормально. Цвет фона был ffffff, Но когда я копирую тот же код в другой фрагмент, все меняется следующим образом.

Я не знаю почему...

пожалуйста, помогите мне.. спасибо

есть коды:

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/dp_4"
    android:layout_marginLeft="@dimen/dp_8"
    android:layout_marginRight="@dimen/dp_8"
    android:layout_marginTop="@dimen/dp_4"
    android:background="@color/color_ffffff"
    android:clickable="true"
    android:foreground="?android:attr/selectableItemBackground"
    app:cardCornerRadius="@dimen/dp_4">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingBottom="@dimen/dp_8"
        android:paddingRight="@dimen/dp_16"
        android:paddingTop="@dimen/dp_8">

        <ImageView
            android:id="@+id/iv_avatar"
            android:layout_width="@dimen/dp_48"
            android:layout_height="@dimen/dp_48"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="@dimen/dp_8"
            android:background="@drawable/ic_account_circle_grey_400_48dp"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:orientation="vertical"
            android:paddingLeft="@dimen/dp_8">

            <TextView
                android:id="@+id/tv_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="2"
                android:textColor="@color/color_444444"
                android:textSize="@dimen/sp_14"
                tools:text="Jinks"/>

            <TextView
                android:id="@+id/tv_mobile"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dp_8"
                android:ellipsize="end"
                android:maxLines="1"
                android:textColor="@color/color_444444"
                android:textSize="@dimen/sp_14"
                tools:text="011-11111111"/>
        </LinearLayout>
    </LinearLayout>
</android.support.v7.widget.CardView>

Но если я использую app:cardBackgroundColor="@color/color_ffffff"фон cardView нормальный. Но если я сделаю это,android:foreground="?android:attr/selectableItemBackground" не были четко видны по телефону.

У меня нет кода для setBackground в Java.

Там неправильный цвет рис: серый backgroundColor

1 ответ

Я использую приложение:cardBackgroundColor="@color/white"

в значениях / цветах создать

Другие вопросы по тегам