Friday, May 27, 2011

[android-developers] SurfaceView vs View (Canvas Size?)

Hi All,

I am writing an application that needs to put a View inside a
ScrollView. Since View is used to display some content that is very
long, I do View.setMeasuredDimension(width, large_height) in View's
onMeasure() callback function. I noticed that no matter how high the
View is, its Canvas size I queried in View.onDraw() is the same with
that of the viewport. This is good since the memory consumption is
only dependent on the size of the viewport. But the downside is that I
have to redraw the entire Canvas manually every time onDraw() is
called.

Instead of View, I can use SurfaceView. However, the problem is that I
cannot do SurfaceView.setMeasuredDimension(width, large_height). I
found that the Canvas size of SurfaceView is the same with its virtual
size (not the same with the viewport as View). So the underlying
Bitmap takes lots of memory and my application won't even run (because
of out of memory).

Does any of you know any solution to this problem? Thank you very
much.

Thanks,
Frank

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate