I use LayerDrawable to create a series of hot spots (indexes 1+) on the base image (index 0). Hot spots are added based on user interface interaction, and their position is dynamic, so I do all this programmatically, rather than using XML. As an additional (probably irrelevant) detail, I use a snippet to hold LayerDrawable, as this is in the context of the FragmentStatePagerAdapter and ViewPager.
The problem is that when I try to update the image by changing Drawable to LayerDrawable using setDrawableByLayerId, the image will not change (even though the method returns true, indicating that it found this layer).
How can I make this work?
source
share