Monday, December 31, 2012

[android-developers] Re: Setting Widget B/G Color of the B/G Resource

I don't think it helps to get access to the drawable resource and use
setColorFilter to set its background color since I don't see a way to
set the modified drawable resource as the background resource for the
view.

Am I missing something obvious? I did google before posting but that
doesn't mean I didn't miss it.

>>>>> "Jake" == Jake Colman <colman@ppllc.com> writes:

Jake> I have written code to select at runtime whether my widget
Jake> should use a background PNG image or just select a background
Jake> color in place of the image. This code works fine but is not
Jake> esthetically pleasing. The problem is that when I set just the
Jake> background color in lieu of the image the entire grid space
Jake> occupied by the widget is colored and it just looks bad.

Jake> My next idea was to specify a different background that
Jake> specifies a <shape> resource instead of the PNG image. This
Jake> code works fine too. At runtime I select one of two values for
Jake> setBackgroundResource and I can see either the PNG image or the
Jake> shaped colored background. This shaped colored background has
Jake> margins and rounded corners so it looks better than just
Jake> coloring the background.

Jake> Here is my question: Is there a way to specify the color of the
Jake> shaped background at runtime? I can call RemoteView.setInt
Jake> with setBackgroundResource to set the shaped background but how
Jake> can I set the resource's background color?

Jake> --
Jake> Jake Colman -- Android Tinkerer

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

--
Jake Colman -- Android Tinkerer

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment