According to android documentation, android:startColor can take attributes as a value:
This may also be a reference to a resource (in the > form "@[package:]type:name") or theme attribute (in the > form "?[package:][type:]name") containing a value of this type. I am trying to add an attribute to my gradiant drawable, however I get an error. Here is the code for the drawable: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <gradient android:startColor="?startColor" android:endColor="#0b2749" android:angle="90" /> </shape> </item> </layer-list> Here is the code in style.xml: <style name="test" parent="android:Theme"> <item name="android:startColor">#0b2749</item> <item name="startColor">#0b2749</item> </style> When I try to run the activity I get this error message: 01-10 20:47:30.810: E/AndroidRuntime(7279): Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2 I tried changing ?startColor to ?attr/startColor and still got the same error. I also applied the theme to the activity in the AndroidManifest.xml file. How can I add a theme attribute to the gradient drawable? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en