【发布时间】:2015-01-08 21:24:06
【问题描述】:
我正在使用 Eclipse,我刚刚创建了一个带有 2 个图像按钮的主页(菜单),但是我收到了这个错误:
布局编辑器中的图形预览可能不准确:
不支持Paint.setShadowLayer。
这是什么意思?我该如何解决?
我正在使用 API 21。
【问题讨论】:
标签: android eclipse android-layout-editor
我正在使用 Eclipse,我刚刚创建了一个带有 2 个图像按钮的主页(菜单),但是我收到了这个错误:
布局编辑器中的图形预览可能不准确:
不支持Paint.setShadowLayer。
这是什么意思?我该如何解决?
我正在使用 API 21。
【问题讨论】:
标签: android eclipse android-layout-editor
表示预览不知道如何实现setShadowLayer。这意味着预览看起来与设备上呈现的结果不完全相同。这是您不应该信任预览应用程序的众多原因之一 - 始终在假设它们完成之前在物理设备上测试您的布局。
【讨论】:
在我的例子中,它是一个新组件,一个支持显示/隐藏密码的 EditText。它出现在支持库 v.24.2.0 中。我的意思是:
<android.support.design.widget.TextInputLayout
android:id="@+id/password_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
app:passwordToggleEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:hint="@string/password"
android:inputType="textPassword"
tools:text="aaaaaaaaaaaaaaaaaaa"/>
</android.support.design.widget.TextInputLayout>
当然,在真实设备上它会正确显示(在预览中也是如此)。
【讨论】:
第一个答案是正确的,但要解决这个问题,你可以试试这个(如果你使用的是 android studio):
File > Invalidate Caches / Restart... > Invalidate and Restart
【讨论】: