Я не могу понять, почему этот код не работает. Может ли кто-нибудь помочь? Я пытаюсь заставить кнопку использовать пользовательский цвет под названием "greenstart" и "greenend". Цвета были созданы в файле res/value/string.xml. Я посмотрел на подобные вопросы, но либо они остались без ответа, неясно, либо решение не сработало. Спасибо заранее.
XML FILE SAMPLE:
<Button
android:id="@+id/mycollection"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<Gradient
android:angle="270"
android:endColor="@color/greenstart"
android:startColor="@color/greenend" >
</Gradient>
</Button>
ОШИБКА:
08-28 21:47:20.574: E/AndroidRuntime(761): FATAL EXCEPTION: main
08-28 21:47:20.574: E/AndroidRuntime(761): java.lang.RuntimeException: Unable to start activity ComponentInfo{My.Taste.App/My.Taste.App.MyTasteActivity}: android.view.InflateException: Binary XML file line #50: Error inflating class Gradient
08-28 21:47:20.574: E/AndroidRuntime(761): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.app.ActivityThread.access$600(ActivityThread.java:123)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.os.Handler.dispatchMessage(Handler.java:99)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.os.Looper.loop(Looper.java:137)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.app.ActivityThread.main(ActivityThread.java:4424)
08-28 21:47:20.574: E/AndroidRuntime(761): at java.lang.reflect.Method.invokeNative(Native Method)
08-28 21:47:20.574: E/AndroidRuntime(761): at java.lang.reflect.Method.invoke(Method.java:511)
08-28 21:47:20.574: E/AndroidRuntime(761): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-28 21:47:20.574: E/AndroidRuntime(761): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-28 21:47:20.574: E/AndroidRuntime(761): at dalvik.system.NativeStart.main(Native Method)
08-28 21:47:20.574: E/AndroidRuntime(761): Caused by: android.view.InflateException: Binary XML file line #50: Error inflating class Gradient
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
08-28 21:47:20.574: E/AndroidRuntime(761): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.app.Activity.setContentView(Activity.java:1835)
08-28 21:47:20.574: E/AndroidRuntime(761): at My.Taste.App.MyTasteActivity.onCreate(MyTasteActivity.java:34)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.app.Activity.performCreate(Activity.java:4465)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
08-28 21:47:20.574: E/AndroidRuntime(761): ... 11 more
08-28 21:47:20.574: E/AndroidRuntime(761): Caused by: java.lang.ClassNotFoundException: android.view.Gradient
08-28 21:47:20.574: E/AndroidRuntime(761): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
08-28 21:47:20.574: E/AndroidRuntime(761): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-28 21:47:20.574: E/AndroidRuntime(761): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:636)
08-28 21:47:20.574: E/AndroidRuntime(761): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
08-28 21:47:20.574: E/AndroidRuntime(761): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
08-28 21:47:20.574: E/AndroidRuntime(761): ... 23 more