I do RemoteView.setInt to call methods on the layout id.  Is there a
way, using a similar technique, to get access to the drawable and mutate
it?  In other words, change the background color of the current
background resource such that the widget uses that modified resource?

I'm sure that the downside of using a "hidden" API is that it can be
removed in a future release and break the app.  Do developers commonly
accept that risk?

>>>>> "KV" == Kostya Vasilyev <kmans...@gmail.com> writes:

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

   KV> NB: marked with a @hide.

   KV> -- K

   KV> 2013/1/1 Jake Colman <col...@ppllc.com>

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

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

Reply via email to