And*_*tor 5 android android-layout android-cardview android-5.0-lollipop
我目前正在尝试使用CardView的cardElevation属性.虽然高度和阴影在KitKat上完美运行,但它并没有出现在我的Lollipop设备上.这是我的XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="72dp">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
card_view:cardElevation="4dp"
card_view:cardCornerRadius="2dp"
card_view:cardUseCompatPadding="true">
<!--Stuff on card view-->
</android.support.v7.widget.CardView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
发生这种情况是因为 Lollipop 上的阴影被CardView. 您需要向 中添加一些填充RelativeLayout或添加android:clipChildren="false"到RelativeLayout.
| 归档时间: |
|
| 查看次数: |
5999 次 |
| 最近记录: |