5

Is there any Wiki or any documents on how to implement android-zoom-view.jar. I found it on http://code.google.com/p/android-zoom-view/ and i wanna try to use it on my application to implement zooming on android scrollview but it's giving me a hard time to do it since i cant find any Wiki about it.

Any comments or suggestions are very much appreciated.

Thanks in advance

jmetran
  • 127
  • 1
  • 8
  • You found some (random) piece of code without documentation and you want to try it? – Veger Jan 10 '13 at 09:12
  • Yes Sir any suggestions? – jmetran Jan 10 '13 at 10:03
  • The code is now in Github, so you should probably fork it and add a README file. https://github.com/Polidea/android-zoom-view FYI, my fork fixes the problem with including the class directly from XML, so you may want to fork my repo instead: https://github.com/daj/android-zoom-view – Dan J Oct 17 '14 at 17:11

2 Answers2

7

I wanna share my code on how to use the android-zoom-view.jar. This is how I use it.

  1. Create a new layout (R.layout.zoomable_view) for Views that i want to apply the zooming functionality.
  2. Place it inside ZoomView.
  3. Then place the ZoomView to the main container where you want to show the zoomable view.

    private ZoomView zoomView;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_zoomable);
    
       View v = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.zoomable_view, null, false);
       v.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    
       zoomView = new ZoomView(this);
       zoomView.addView(v);
    
       main_container = (LinearLayout) findViewById(R.id.main_container);
       main_container.addView(zoomView);            
    }
    

I hope this will help others.

jmetran
  • 127
  • 1
  • 8
  • I just tried your code with no result, but its exactly as you wrote. any ideas? – Peter Jan 29 '13 at 20:04
  • add more object to R.layout.zoomable_view – jmetran Jan 30 '13 at 04:02
  • hi, i followed your instructions and got zoomview but when i touch edges it automatically zooms in and zooms out how to solve this issue.is it possible to disable zoomview in single touch event. – user1083266 May 07 '13 at 11:29
  • private void processerase(final MotionEvent ev) { final float x = ev.getX(); final float y = ev.getY(); switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: touchStartX = x; touchStartY = y; touchLastX = x; touchLastY = y; break; case MotionEvent.ACTION_MOVE: break; case MotionEvent.ACTION_UP: break; } ev.getX(); ev.getY(); super.dispatchTouchEvent(ev); } – user1083266 May 09 '13 at 05:38
  • i tried in this way but after zooming i am not getting correct points – user1083266 May 09 '13 at 05:41
  • On my side it's not zooming when i tap the edges. It only zoom when you double tap it. I suggest to re-download their library and re-build your app. Let me know if it's working as it should. – jmetran May 10 '13 at 06:20
  • it cause of onDraw method continuous calling. I create an custom view and place it as you suggest here. I checked with my custom view it simply draw once and sit, but as I map it with ZoomView it started to call onDraw frequently..any suggestion here!! – CoDe May 20 '14 at 07:24
  • I have along scrollview , but it's just take a small part and prevent me to see the full of that text in my scrollview :/ ..... any help please ?! – Amer Hadi Nov 18 '14 at 07:28
  • I would suggest to get first the dimensions of zoomview and apply it on scrollview. hope this solved your problem – jmetran Nov 19 '14 at 02:12
  • @jmetran: I am facing the same scroll area lock issue in `ListView`. Any idea how to get rid of it? – Green goblin Feb 03 '15 at 21:39
  • @Aashish Sorry i haven't tried it yet. You can check the conflict between ListView and ZoomView scroll area. – jmetran Feb 04 '15 at 06:52
  • It there is scrollview in this zoomview with multiple sub views it only scroll visible view when zoomed. Is there any solutions for scrolling all the sub views when zoomed which are invisible. – Prateek Negi Jan 15 '20 at 12:58
1

When looking at the project, you can assume that it is not used (very) much. Therefore, looking for official documentation (no Javadoc is used in the source...) or tutorials seems pointless.

So you have to do it yourself, so check out the only java source file the project has, it does not look to difficult to use:

  • Notice that the class extends the FrameLayout class, so you can assume it will behave as a regular FrameLayout. So check out FrameLayout related tutorials.
  • Focus on the public methods, as it defines the 'API' of the Zoomlayout
Veger
  • 37,240
  • 11
  • 105
  • 116