1

I am a novice of Android developing. Now I am working on a problem that need to zoom in and out a image view depending on the moving of your finger. Obviously, animation can not handle such work. To find an optimal solution, I use a seek bar to control the size of the image view. My code is like this:

 public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        int newSize = minSize + (int) ((maxSize - minSize) / 100.0 * progress);
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mImage.getLayoutParams();
        int origSize = lp.width;
        if(newSize != origSize) {
            lp.height = newSize;
            lp.width = newSize;
            mContainer.requestLayout();
        }
    }

I am doubt the efficiency of my method. It is very helpful if anyone have done a similar work before could give me some suggestions.

Eric Huang
  • 33
  • 4
  • Possible duplicate of [Android Image View Pinch Zooming](http://stackoverflow.com/questions/10630373/android-image-view-pinch-zooming) – random Dec 28 '15 at 07:22
  • using matrix to scale a image view seems a good solution, thanks! – Eric Huang Dec 28 '15 at 07:34

0 Answers0