I'm having some trouble with CardView transparency and card_elevation. Trying to use a CardView transparent the result is:
Without transparency:
What I'm trying to get is something like this:
Here is my xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/eifell"
android:padding="10dp"
tools:context=".MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:background="@android:color/transparent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/newsCardView"
android:layout_width="match_parent"
android:layout_height="175dp"
card_view:cardBackgroundColor="#602B608A"
card_view:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I know i am a bit late, but it's just because of card default elevation. Set it to zero to solve your problem.
app:cardElevation="0dp"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With