Tuesday, July 26, 2011

[android-developers] Sluggish zoom and scroll with GridView in Android

down vote favorite


I'm creating a custom view derived from GridView. This contains a
custom ImageView with zooming and panning functionality. Scroll and
zoom functionality is sluggish. If the parent view is the same custom
ImageView instead of a GridView it works perfectly. I'm trying to do
this because I need a static background image with an interactive area
at the center. Zoom and scroll are implemented similar to this
article: http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-6-implementing-the-pinch-zoom-gesture/1847

I uploaded a test project reproducing the problem here:
http://www.steema.com/files/public/support/HelloAndroid.zip.

The OnCreate method is implemented like this:

@Override public void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);

View myView1;
boolean sluggish = false;

if (sluggish) {
myView1 = new MyGridView(this);
}
else {
myView1 = new MyImageView(this);
}

setContentView(myView1);

}

If you set the sluggish variable to true you'll see ImageView works
much better for that. Do you have any idea why using GridView turns
zoom and scroll unusable or how can this be solved?

I'm not using a "dynamic" ImageView into a "static" ImageView because
I haven't found how to embed an ImageView into another ImageView.

Thanks in advance.

--
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

No comments:

Post a Comment