Some controls won't let me set the drawables from code. For instance, AnalogClock and TransitionDrawable.
On Mar 9, 3:08 pm, Romain Guy <romain...@google.com> wrote: > Why don't you just create a Drawable manually instead? > > new BitmapDrawable(BitmapFactory.decodeXXX(...)) > > On Mon, Mar 9, 2009 at 1:47 PM, van.etten.m...@gmail.com > > > > <van.etten.m...@gmail.com> wrote: > > >> you can do drawable.createFromPath(), cant 'inflate' drawable > > That makes a new drawable, I want to change the one already loaded. > > You can inflate drawables using the <bitmap> tag. > > >> getDrawable() already inflate drawables if the drawable uses XML. > > Yes, but it inflates using the png defined in the XML. I now want to > > change that png to a different png at runtime. > > > Basically, I would want to do this if it were possible: > > getContext().getResources().setDrawable(R.drawable.clock_dial, > > Drawable.createFromPath("x")); > > > On Mar 9, 2:11 pm, Romain Guy <romain...@google.com> wrote: > >> getDrawable() already inflate drawables if the drawable uses XML. > > >> On Mon, Mar 9, 2009 at 1:06 PM, Jay Liang <zl25dre...@gmail.com> wrote: > >> > you can do drawable.createFromPath(), cant 'inflate' drawable > > >> > On Mon, Mar 9, 2009 at 4:00 PM, van.etten.m...@gmail.com > >> > <van.etten.m...@gmail.com> wrote: > > >> >> Lets say I inflate a view. Now I want to change a drawable to a > >> >> different png. > > >> >> I was thinking of something like this: > > >> >> Drawable drawable = getContext().getResources().getDrawable > >> >> (R.drawable.clock_dial); > >> >> drawable.inflate( resources, xmlParser, attrs ); > > >> >> Actually, I want to inflate from another context/app. I started > >> >> looking at themes, but I don't see that is covers drawables. Perhaps > >> >> there is a better way? Am I missing a formal way of doing this? > > >> >> Thanks for you help, > >> >> John > > >> >> On Mar 9, 12:26 pm, Romain Guy <romain...@google.com> wrote: > >> >> > What do you mean exactly? > > >> >> > On Mon, Mar 9, 2009 at 11:24 AM, van.etten.m...@gmail.com > > >> >> > <van.etten.m...@gmail.com> wrote: > > >> >> > > Is it possible to change an existing drawable instance by calling > >> >> > > it's > >> >> > > inflate method? I was hoping to implement skinning by simply > >> >> > > changing > >> >> > > my drawables after the view is inflated since there appears to be no > >> >> > > way to do it while inflating. > > >> >> > > Perhaps I'm missing a better way? > > >> >> > -- > >> >> > Romain Guy > >> >> > Android framework engineer > >> >> > romain...@android.com > > >> >> > Note: please don't send private questions to me, as I don't have time > >> >> > to provide private support. All such questions should be posted on > >> >> > public forums, where I and others can see and answer them > > >> -- > >> Romain Guy > >> Android framework engineer > >> romain...@android.com > > >> Note: please don't send private questions to me, as I don't have time > >> to provide private support. All such questions should be posted on > >> public forums, where I and others can see and answer them > > -- > Romain Guy > Android framework engineer > romain...@android.com > > Note: please don't send private questions to me, as I don't have time > to provide private support. All such questions should be posted on > public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "android-framework" group. To post to this group, send email to android-framework@googlegroups.com To unsubscribe from this group, send email to android-framework+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-framework?hl=en -~----------~----~----~----~------~----~------~--~---