Reputation: 53
Here is the xml code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.himanshu.staticlogin.MainActivity"
android:weightSum="1">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
card_view:cardBackgroundColor="@color/cardview_dark_background"
card_view:cardElevation="10dp"
android:clickable="true"
/>
</LinearLayout>
It shows elevation in the preview but when I run the file it does not. What am I doing wrong?
Upvotes: 1
Views: 140
Reputation: 3273
Use card_view:cardUseCompatPadding="true"
in your xml to show elevation on pre Lollipop androids.
Upvotes: 0