【问题标题】:layout elevation attribute doesn't apply in android studio design preview布局高程属性不适用于 android studio 设计预览
【发布时间】:2018-07-01 19:39:05
【问题描述】:

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

这里有一些图片:

【问题讨论】:

  • 这么简短的描述很难说清楚。您是否尝试在另一台计算机/操作系统/显卡/不同的 Android Studio 版本上打开您的项目?您是否尝试在 Android Studio 的问题跟踪器上查找您的问题? Android Studio 的预览版总是有很多奇怪的问题,所以如果你的也是其中之一,我不会感到惊讶。
  • @Zielony 帮个忙,你能不能用一个简单的 textView 创建一个布局,比如说一个 8dp 的高程属性,然后告诉我你的 android studio 设计预览有什么不同吗?抱歉,我只有一台电脑,所以我无法测试是否是您提到的问题。让我知道结果如何?设计预览有变化吗?

标签: android android-studio material-design


【解决方案1】:

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

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>

【讨论】:

  • 至少不是我电脑的问题。感谢您回来并回答我的问题。当我设计带有高程的布局时,我现在唯一要做的就是不断运行应用程序。
猜你喜欢
  • 1970-01-01
  • 2018-11-20
  • 2019-07-17
  • 1970-01-01
  • 1970-01-01
  • 2014-12-23
  • 2016-04-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多