TransitionDrawable with different sized bitmaps

by Brill Pappin » Fri, 20 May 2011 04:20:29 GMT


Sponsored Links
 I'm using a TransitionDrawable to draw a series of bitmaps in an ImageView.
Every time my scheduled handler ticks over, i replace the bitmaps.

I'm finding that if they are not the same size, the draw splits the 
difference for the second bitmap using the first bitmap (at least I think 
thats whats going on).

I was thinking that I might use two bitmaps there were the same size as a 
base, then draw my actual jpeg's onto those so the TransitionDrawable 
doesn't try and scale them.

Is there a better way to do this?

-- 



Re: TransitionDrawable with different sized bitmaps

by Brill Pappin » Fri, 20 May 2011 12:24:42 GMT


 An update to this problem.
It seems the issue is related to ImageView's automatic scaling somehow.
it *looks* as if the TransitionDrawable needs both images to be the same 
size... or maybe ImageView does it.
The symptom is that it divides the difference in width between the to images 
(i.e. an image in landscape and one in portrait so you get one squashed and 
one stretched).


-- 


Sponsored Links


Re: Re: TransitionDrawable with different sized bitmaps

by Dianne Hackborn » Fri, 20 May 2011 12:36:58 GMT


 The images need to be the same.  Generally widgets don't like nor have a way
to deal with drawable dimensions changing out from under them.







-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 



Re: Re: TransitionDrawable with different sized bitmaps

by Brill Pappin » Fri, 20 May 2011 12:46:47 GMT


 The funny thing is how its actually handling it. Both parts of the 
transition are getting scaled.

What i'm doing is cycling through images from the MediaResolver (like camera 
shots) and crossfading between them.
Do you have any suggestions for other ways to do that?

At the moment I'm playing around with creating a "template" bitmap that is 
used to draw everything onto, then give it to the ImageView, but I'm not 
feeling all that good about the solution so far.

-- 



Re: Re: TransitionDrawable with different sized bitmaps

by Dianne Hackborn » Fri, 20 May 2011 15:10:21 GMT


 You could write your own Drawable that keeps its size consistent across the
images and does whatever transition you want.  Or use a ViewFlipper to swap
between ImageViews.







-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 



Other Threads

1. Android Newby here

Hi,

Was wondering if anyone knows which version of Android provides support for 
Mobile Device Management (MDM) ?  

Thanks!
Arvind

-- 

2. URLClassLoader to load an Android application components dynamically

Fellow Android Developers,

To minimize the size of the application and to inject services to an
Andriod Application on demand - I have parts of my application
implemented as a libraries. I would like to download one or more
libraries on demand from a trusted server and run them as part of the
application.

The first thing I did is to use the URLClassLoader with the URL to the
trusted server and tried to load android library (packaged as a .apk
file) and to located classes inside them. This did not succeed -
the .apk file was downloaded from the server, but failed to find the
class in that file.

dalvik.system.DexClassLoader and dalvik.system.PathClassLoader can
only load files from the local file system on the device.

Have any of you run into this scenario? Your assistance is
appreciated.

Thanks in advance.

Best Regards,
Sidda

--

3. Final Class and Android Compatibility [CTS]

4. Android WhiteBoxTesting

5. WifiLock and WakeLock regarding large downloads

6. Reference styles across apps

7. Writing a scripts for Android system