Dev0ps
Dev0ps

Reputation: 71

XML-drawable don't work correctly using layer-list

When i work with XML-drawable file using layer-list it does not appear in Preview and does not work as a background for the elements (in particular Spinner).

Drawable-XML listing:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:layout_height="wrap_content" android:shape="rectangle">
            <solid android:color="#f3f4f6"></solid>
            <size android:width="500px" android:height="100px"></size>
            <corners android:radius="35px"></corners>
        </shape>
    </item>
    <item>
        <bitmap android:src="@drawable/down-arrow" android:gravity="center|right"></bitmap>
    </item>
</layer-list>  

How to fix? Regards...

Upvotes: 1

Views: 53

Answers (1)

 Ekalips
Ekalips

Reputation: 1491

Answer is probably easier than you think:

You can't use "-" as a file resource name. File resource names should contain only lowercase a-z, 0-9 or underscore.

Just rename your @drawable/down-arrow resource to @drawable/down_arrow (rename source image file)

Upvotes: 2

Related Questions