【发布时间】:2015-04-02 15:43:24
【问题描述】:
我有以下用于卡片视图的 xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:padding="2dp">
<!-- A CardView that contains a TextView -->
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="wrap_content"
card_view:cardCornerRadius="0dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">
<TextView
android:id="@+id/info_text"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
这会导致这些阴影在底部根本没有阴影
但我正在尝试获得类似这种阴影的东西,它可以更好地包围整张卡片。
我尝试更改海拔高度但无济于事,搜索此问题似乎除了没有阴影的人根本没有问题,这不是我的情况。
我怎样才能得到正确的阴影?
谢谢。
【问题讨论】:
-
谢谢,这解决了我的问题。奇怪的是,您必须为 API v21 和 forward 添加此标签。我理解的对吗?
-
这只是 Android 碎片化,只需将其堆栈溢出并继续进行下一个功能。
-
我可以只在底部显示阴影(卡片视图的一侧)吗?
标签: android android-layout android-5.0-lollipop shadows