How to display a “zoom-able” SVG file in Android?

2019-07-29 07:06发布

My question is somewhat based off of this question. Displaying SVG files in Android

I have decided to display an SVG in my app, and I do so using the svg-android library. My problem is now how to add pinch to zoom functionality. Maybe this library is outdated and someone knows of another to accomplish this task. From what I see in the javadocs of svg-android, there doesn't seem to be any easy way to add pinch to zoom.

标签: android svg
1条回答
forever°为你锁心
2楼-- · 2019-07-29 07:44

That's not something that needs to necessarily be part of the SVG library. You just need to implement onTouchEvent() in your view and use a ScaleGestureListener etc to keep track of your scales and pans.

http://developer.android.com/training/gestures/scale.html

查看更多
登录 后发表回答