据我所知,在预览阶段的早期,似乎没有办法在CardView
上不使用Java语言在XML中设置elevation。既然官方发行版已经发布,有没有办法在XML中实现这一点,而无需编写Java代码来设置标高呢?
我已经尝试了card_view:cardElevation
,但没有效果。当我使用5.0版本的仿真器时,我认为一切都很好。但是现在我在我的实际设备上使用了正式版本,所有的CardView
都消失了。
在棒棒糖之前,它的效果很好。
下面是我的完整xml
<?xml version="1.0" encoding="utf-8"?>
<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:orientation="horizontal"
android:layout_width="match_parent"
android:id="@+id/cv1"
card_view:cardElevation="4dp"
android:layout_margin="6dp"
card_view:cardCornerRadius="3dp"
android:layout_height="match_parent">
https://stackoverflow.com/questions/26997109
复制相似问题