Update transition drawable with new images during program execution?
In the application开发者_高级运维 I'm making, I'd like to have a background in the main menu that crossfades between different images. The application also allows for the user to take photos. I want to set up the application so that the photos the user takes are also used in the crossfading background.
The Transition Drawable seems to be the best match for crossfading the background. However, updating the images that the drawable displays without changing the code to add in references to new resources doesn't seem to be possible. Can I update the transition drawable with new images without having to code in the references? If not, is there an alternative way of making this work?
Use td.setDrawableByLayerId(td.getId(1), drawable)
on your TransitionDrawable
. LayerDrawables
support this.
You could take a look at the source to see if it makes sense to derive from it maybe.
精彩评论