https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/widget/RemoteViews.java

#setDrawableParameters

NB: marked with a @hide.

-- K

2013/1/1 Jake Colman <[email protected]>

>
> 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 <[email protected]> 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
> [email protected]
>    Jake> To unsubscribe from this group, send email to
>    Jake> [email protected]
>    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 [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
>

-- 
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