Image on the left is what I'm looking for. If you look carefully at my result on the right you can see the white rounded corners in the bottom, but still no shadows.
I'm using Glide to load some images inside a CardView. I'm not sure exactly what the problem is, but I suspect it's with Glide. In the layout preview the CardView looks as I want it, but not when I load it up in the emulator or real device.
Glide.with(mContext)
.load(image.getSmall())
.fitCenter()
.crossFade()
.bitmapTransform()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(holder.coverImageView);}
XML
<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:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/card_height"
android:orientation="vertical"
android:weightSum="4">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3.5"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal">
<ImageView
android:id="@+id/coverImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|bottom"
android:background="@android:drawable/screen_background_dark_transparent"
android:orientation="vertical">
<TextView
android:id="@+id/titleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:textColor="#FFFFFF"
android:textSize="@dimen/text_size"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</LinearLayout>
The problem wasn't the layout or Glide. A few weeks ago I added this:
android:hardwareAccelerated="false"
android:largeHeap="true"
to my Manifest because of memory management problems (my app would stop responding in Geneymotion). Turns out it created more problems than solving them.