android - 布局高程属性不适用于 android studio 设计预览

标签 android android-studio material-design

谁能解释一下为什么我在 android studio 设计预览中看不到海拔效果,但只有在运行应用程序时才能看到?

下面是一些图片:

enter image description here

enter image description here

最佳答案

好吧,我只是做了我们讨论的事情,我没有看到任何影子。我正在使用 AS 3.1.3。请参阅下面的代码。该按钮有一些阴影,但它不受海拔高度的影响,所以我想它只是其背景的 9 补丁或其他任何东西的一部分。我在问题跟踪器中没有看到任何当前问题。

https://issuetracker.google.com/issues?q=shadow%20design

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/carbon_white"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:background="@color/carbon_white"
        android:elevation="8dp"
        android:text="test"/>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_margin="16dp"
        android:background="@color/carbon_white"
        android:elevation="8dp"
        />

    <Button
        android:id="@+id/button5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:elevation="8dp"
        android:text="Button"/>
</LinearLayout>

shadow test

关于android - 布局高程属性不适用于 android studio 设计预览,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51126448/

相关文章:

java - View.OnClickListener() 函数或接口(interface)

java - 构建调试 apk 时无法合并 dex 错误

Angularjs Material 一排两列

android - 自定义抽屉导航的涟漪效应

android - 当页面在 ViewPager2 中不可见时如何停止视频

android - Activity 中的复选框状态更改

Java - 比较器

android-studio - 从 Android Studio 导出快捷方式

java - 为什么我没有权限将文件保存到 SD 卡中?

android - 如何自定义android Material 调色板