LoginSignup
13
11

More than 5 years have passed since last update.

Lollipop で CardView に影がつかない時の対処法

Posted at

原因

Lollipop とそれ以前の OS バージョンでは CardView のサイズが違うため、
Lollipop でも影は出ているが、カードが被ってしまって影が見えなくなっている。

対応

card_view:cardUseCompatPadding="true" を CardView のプロパティに設定する。

layout.xml
<android.support.v7.widget.CardView
    android:id="@+id/media_card_view"
    android:layout_width="match_parent"
    android:layout_height="130dp"
    card_view:cardBackgroundColor="@android:color/white"
    card_view:cardElevation="2sp"
    card_view:cardUseCompatPadding="true"
    >
...
</android.support.v7.widget.CardView>
13
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
11