Implement scaling on scrollView android

I am trying to create an application that uses scrollView in Android. It so happened that scrollView does not support matrices. Therefore, I cannot do something like this:

Matrix matrix = new Matrix(); Matrix eventMatrix = new Matrix(); // possible touch states final static int NONE = 0; final static int DRAG = 1; final static int ZOOM = 2; int touchState = NONE; 

Does anyone know if it is possible to achieve scalability as well as compress functionality through another process? Appreciate the help.

Thanks.

[RE-EDIT]

ScrollView will serve as a container so that various user interfaces can be placed in it. Thus, scrollView can serve as one part of the user interface.

Thanks.

+4
source share
3 answers

Depending on your specific requirements, there are several possible approaches to this problem:

  • You can create a view and adjust its layout settings during the onScroll event.
  • For easy scaling, you can watch the animation. This should effectively give you a zoom effect. For a specific item in a scroll view.
  • If you need to enlarge the entire scrollView, you can surround it with a view container (for example, LinearLayout) and scale this view.
+2
source

I'm not sure that you are using ScrollView, but you should take a look at this Android developer article - Understanding multitouch for pinch / zoom features.

+1
source

If you intend to provide scalability for the image, then you're in luck! I wrote a fairly thorough class that extends ImageView to add scale and pan functions with boundary testing. Check here . If this is not what you want, then you will need to provide additional information about what exactly you want to do. But this code can be tailored to your needs.

0
source

All Articles