简体   繁体   English

CardView 海拔未显示在棒棒糖和更高版本中

[英]CardView elevation not showing in lollipop and higher versions

I was using cardview, but the problem is elevation not showing in lollipop and higher versions.我使用的是 cardview,但问题是在 lollipop 和更高版本中没有显示海拔。 please suggest me.Here is my code.请建议我。这是我的代码。

<android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/verify_card"
        android:layout_weight="1"
        card_view:cardBackgroundColor="@android:color/white"
        card_view:cardElevation="2sp"
        card_view:cardUseCompatPadding="true"
        />

Thanks in advance.提前致谢。

this worked for me. 这对我有用。

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"

total code is: 总代码是:

<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:layout_width="match_parent"
    android:layout_margin="8dp"
    android:id="@+id/card_griditem"
    android:layout_height="match_parent"
    card_view:cardUseCompatPadding="true"
    card_view:cardElevation="4dp"
    card_view:cardCornerRadius="3dp">`

Make sure you have set android:hardwareAccelerated="false" as true in Manifest.确保您已在 Manifest 中将android:hardwareAccelerated="false"true By setting it to false your application will not able to use GPU and can't make some 2D designs.通过将其设置为 false,您的应用程序将无法使用 GPU 并且无法进行某些 2D 设计。

安卓:硬件加速=“真”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM