Hello, in two different activities i want to use same gradient
drawable but with different colors. I think to refer gradient colors
to activity theme in follow way:

i've added follow rows in attrs.xml

<attr name="backgroundTopColor" format="color" /> <attr
name="backgroundBottomColor" format="color" />

in bg_gradient.xml i typed

<shape xmlns:android="http://schemas.android.com/apk/res/android";>
<gradient android:startColor="?backgroundTopColor" android:endColor="?
backgroundBottomColor" android:angle="270" /> <corners
android:radius="0dp" /> </shape>

In activity theme, i've added

<item name="backgroundTopColor">#FFFFFFFF</item> <item
name="backgroundBottomColor">#FFFFFF00</item>

After application start in logcat

` 02-07 14:03:59.479: ERROR/AndroidRuntime(2096): Caused by:
java.lang.UnsupportedOperationException: Can't convert to color:
type=0x2 02-07 14:03:59.479: ERROR/AndroidRuntime(2096): at
android.content.res.TypedArray.getColor(TypedArray.java:326) 02-07
14:03:59.479: ERROR/AndroidRuntime(2096): at
android.graphics.drawable.GradientDrawable.inflate(GradientDrawable.java:
647) 02-07 14:03:59.479: ERROR/AndroidRuntime(2096): at
android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:
788) 02-07 14:03:59.479: ERROR/AndroidRuntime(2096): at
android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
02-07 14:03:59.479: ERROR/AndroidRuntime(2096): at
android.content.res.Resources.loadDrawable(Resources.java:1694) 02-07
14:03:59.479: ERROR/AndroidRuntime(2096): ... 29 more

`

How i can solve this?

Thank you

NB: Api level = 8

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to