Android 海拔属性不起作用

标签 android android-layout

自升级到 SDK 21 以来,我一直在尝试使用 elevation 属性,但它似乎从未起作用。

我想将框架提升到其他框架之上,所以我设置了以下内容

android:elevation="4dp"

可是一点影子都没有。我试过按钮和框架布局,但没有任何提升

这是完整的标签

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/panel_card"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ffffff"
    android:elevation="4dp"
    >

我是否缺少其他需要添加的东西

最佳答案

确保容纳 FrameLayout 的容器的背景不是透明的。

关于Android 海拔属性不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26812731/

相关文章:

android - CoordinatorLayout + AppbarLayout + Viewpager 不调整子布局的大小

java - android.view.InflateException : Error inflating class androidx.constraintlayout.widget.ConstraintLayout

javascript - 如何在模拟器上运行 ionic 应用程序?

android - 在 RecyclerView 中选择项目时,如何防止 notifyItemChanged() 消除链式 react ?

java - 在 TextView 的背景中,在 fragment 中的每个图像上绘制圆圈

java - android studio design 和 v7 中的导入错误 - Android Studio -

android ArrayAdapter 加载 1000 个元素很慢

android - margin 不影响 "include"

android - IllegalArgumentException 参数必须是此 View 在 ViewGroup.offsetRectBetweenParentAndChild 处的后代

java - 什么是 textview.setTextSize()?