Error: "The graphics preview in the layout editor may not be accurate: Paint.setShadowLayer is not supported"
Asked Answered
R

3

23

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.

Rubrician answered 8/1, 2015 at 21:24 Comment(0)
J
31

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.

Jackiejackinoffice answered 8/1, 2015 at 21:35 Comment(3)
thanks for the fast replay, so you mean if I tried it on my phone the images will be shown normally?Rubrician
This answer applies to EVERYTHING that the preview does. Of course you should test it. But what exactly is happening to cause the setShadowLayer to not be implemented? The error usually doesn't show, which means that something is different...what?Elated
The devs got lazy and didn't even try to implement it, they just put in the warning instead.Jackiejackinoffice
O
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).

Ohmage answered 18/9, 2016 at 10:6 Comment(2)
I just stumbled over this with design / appcompat libs at 23.4.0. If I force a progress bar to be visible the preview goes away and this error "Paint.setShadowLayer is not supported" is shown... This is with a coordinator layout with toolbar, nested scroll view, and FAB. Guess I will try the latest versions to see what happens.Pero
@JimAndreas, thank you. If you wish, you can add a new answer below.Ohmage
S
1

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
Selfregulated answered 25/10, 2018 at 8:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.