1

i am trying to make CardView with elevation but the issue is when i use no-alpha color like "#ffffff" it works fine but when i set some alpha color like #b0ffffffit shows another inner view with elevation like this

enter image description here

but when i set non-alpha color like"#ffffff" it works fine

enter image description here

and this is my layout

    <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:background="#b0ffffff"
    android:layout_centerInParent="true"
    card_view:cardBackgroundColor="#b0ffffff"
    card_view:cardElevation="5dp">

    <ImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_gravity="center"
        android:src="@drawable/people" />

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

btw i am trying to make a view like this

enter image description here

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Mateen Chaudhry
  • 631
  • 12
  • 32

2 Answers2

0

just remove the line:

card_view:cardBackgroundColor="#b0ffffff"

and it should work

Udit
  • 1,037
  • 6
  • 11
0

Try this

           <android.support.v7.widget.CardView
                android:layout_width="100dp"
                android:layout_height="100dp"
                app:cardBackgroundColor="#B0FFFFFF"
                app:cardCornerRadius="50dp"
                app:cardElevation="5dp">

                <ImageView
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:layout_gravity="center"
                    android:src="@drawable/people" />

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