I am working on Camera application, I am having image with numbers from 1 to 35 I want to achieve following structure for controlling zoom feature but I got stuck in user interface implementation.
Application requirement is, user can scroll the image from left to right OR right to left and select one number from image so I can use that number and set zoom.
How to scroll the image and get input from user ?
is there any library available for this ?
Crop the image to the size you want displayed and centered where you want, register to drag events on the image view, find out how much the user scrolled and adjust your crop center based on that value. Calculate how much the user has to scroll for your number to change and change an int value accordingly.
Check out https://developer.android.com/training/gestures/scale.html for more info on handling drag events.
I'll post code when I get home tonight if you still need it
** I can't add images since I have (re)started using stack overflow recentley, refer to the image in the link below for [A], [B]...** https://i.stack.imgur.com/9b7kg.png
Explanation:
Imagine you have an image like [A] and you want to implement custom scrolling. Theoretically, divide it into parts like in [B]. The way I would implement scrolling on an imageview is create a bitmap out of the image that covers only parts of it (for me, the image is size 5*180x 180, I want the bitmap displayed to be 3*180 x 180 so it can only cover 3 boxes at most (refer to [C]). Then I would add an OnTouchListener to the activity and listen to touches on the imageView, when the imageView is dragged on, register the difference and create a new image accordingly [D], make sure the new bitmap image doesn't go out of focus. Look at my implementation below for reference.
Implementation
My layout file
My Activity