I'm using svg-android library to deal with SVG's in my app. Long story short, this lib generates a (Vectorial) PictureDrawable
from a SVG.
Unfortunately, Android can't drawPicture()
into a canvas using Hardware Acceleration, so to achieve acceleration I have to transform the Picture inside the PictureDrawable into a Bitmap.
The problem is, if the drawable host size changes after the bitmap has been created, I have to resample to the new resolution.
I have overriden:
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
if (Conf.LOG_ON) Log.d(TAG, "OnBoundsChange "+bounds);
createBitmapWithNewBounds();
}
It works when I manually call setBounds
, but when the drawable host size changes, onBoundsChange()
is not automatically called (and I don't know if it should be).
So is there any way for the drawable to detect its host size has changed so:
- I can trigger a manual call to
setBounds()
? onBoundsChange()
is automatically called?