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.