【发布时间】:2015-02-23 13:38:11
【问题描述】:
我在我的 android 应用程序中使用 cardview。然而阴影并没有出现。这是xml布局
默认的选项菜单阴影也没有显示。
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ECEDF0"
android:orientation="vertical" >
<android.support.v7.widget.CardView
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_gravity="center"
android:clipChildren="false"
card_view:cardBackgroundColor="@color/white"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="14dp"
card_view:cardUseCompatPadding="true" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Google Play" />
</android.support.v7.widget.CardView>
</LinearLayout>
【问题讨论】:
-
我认为linerlayout的背景和阴影的颜色比较相似。尝试更改衬里布局的颜色,然后检查它是否可见。
-
改变了颜色但没有运气@PankajKumar
-
牵强,但我已经看到这种情况发生,尝试删除 CardView 下方的 xmlns:card_view="schemas.android.com/apk/res-auto" 以便您只有在 LinearLayout 中的那个。
-
试过但阴影不可见
标签: android android-layout android-5.0-lollipop android-cardview