tags:

views:

541

answers:

1

I dropped the following into the drawable directory in my Android 1.5 project:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gradient">
    <gradient android:startColor="#FFFF00" android:endColor="#FFFFFF" android:angle="270"/>
    <corners android:radius="0dp" />
</shape>

I get

java.lang.ClassNotFoundException
    at com.android.ide.eclipse.adt.internal.resources.manager.ProjectClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(Unknown Source)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:198)
    at android.view.BridgeInflater.onCreateView(BridgeInflater.java:99)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:122)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:385)

etc etc etc in my Eclipse console.

I also get the same ClassCastError in my logcat when I try to run the thing in my emulator, setting that drawable to be the background on a linear layout.

Any ideas?

A: 

Just a hunch, but you didn't define what type of shape you wanted.

Try adding android:shape="rectangle" to the shape element and see if it helps.

Trevor Johns
Perfect! I guess I assumed rectangle was the default... or rather, I just never thought about it. Thank you.
Brian W.