Error: “The graphics preview in the layout editor may not be accurate: Paint.setShadowLayer is not supported”

ぃ、小莉子 提交于 2019-12-18 05:29:04

问题


I'm using Eclipse and I just created a home page (menu) with 2 image buttons, but I am getting this error:

The graphics preview in the layout editor may not be accurate:

Paint.setShadowLayer is not supported.

What does it mean? And how can I solve it?

I am using API 21.


回答1:


It means the preview doesn't know how to implement setShadowLayer. This means the preview won't look exactly like the result rendered on the device. Which is one of many reasons why you shouldn't trust the preview app- always test your layouts on a physical device before assuming they're done.




回答2:


In my case it was a new component, a EditText with support of showing/hiding a password. It appeared in support library v.24.2.0. I mean:

<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>

Of course, on a real device it is shown right (and in preview also).




回答3:


As the first answer is true, but for fixing this issue you can try this (If you are using android studio) :

File > Invalidate Caches / Restart... > Invalidate and Restart


来源:https://stackoverflow.com/questions/27849762/error-the-graphics-preview-in-the-layout-editor-may-not-be-accurate-paint-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!