0

I'm trying to implement pinch-to-zoom on a ListView which contains small pieces of code. However, I can't seem to get it to work. I suspect it may be not possible to implement multitouch zoom on a ListView. I currently have used this implementation: http://www.allappsdevelopers.com/TopicDetail.aspx?TopicID=c16ed3b4-b422-43ba-b595-ee8e21dd1854

My target is Android 2.2+. Does anyone have an example of pinch-to-zoom to zoom in and out on the text? Or is it just not possible to do it effectively on a ListView?

I would include my code, but it's similar to that in the above example.

Thanks.

xBlue
  • 523
  • 2
  • 7
  • 15

1 Answers1

2

Use this code for implementing pinch-to-zoom on any custom view.

And to make sure that the ListView responds to all the events and not only the pinch gesture, override onTouchEvent() in the following way to let the ScaleGestureDetector detect/handle all the events.

@Override
public boolean onTouchEvent(MotionEvent e) {
    myScaleDetector.onTouchEvent(e);
    return super.onTouchEvent(e);
}
Community
  • 1
  • 1
Swayam
  • 16,294
  • 14
  • 64
  • 102