'Display larger ruler on android scroll view

I do have long ruler image (shown below) that I need to use as scrollable view on android device.

Can some one please advice for the best way to do the same?

I tried this in two ways,

Initially I tried to put image as background to scroll view but that didn't work as image is too long/large.

Currently I am trying to use BitMap class to crop my image and use the part what I want to display. But again an issue is on every scroll need to crop another part of image and display the same such a way that it will not reflect on screen.

setContentView(R.layout.activity_demo);
    ImageView image = (ImageView) findViewById(R.id.imgScaleFirst);
    Options opts = new Options();
    opts.inDither = true;
    opts.inPreferredConfig = Bitmap.Config.ALPHA_8;
    opts.inScaled = false; /* Flag for no scalling */ 


    /* Load the bitmap with the options */      
    //Bitmap bMap = BitmapFactory.decodeResource(getResources(), R.drawable.lbs_ruler_vert_left,opts);


    Bitmap bmap= BitmapHelper.decodeFile(getResources().openRawResource(R.drawable.lbs_ruler_vert_left),182, 4096, true);
    image.setImageBitmap(bmap);

I appreciate your input/idea for same.

enter image description here



Solution 1:[1]

Please check https://dhingrakimmi.wordpress.com/2015/09/17/android-measurment-scale-my-scale/?preview_id=2 This will show scale without any limit.

Solution 2:[2]

I found this link while searching for a similar requirement to draw a ruler. Hope this helps someone in future.

https://code.google.com/p/ruler-android/source/browse

The idea here is to create a custom view and use canvas to draw lines at appropriate intervals.

Solution 3:[3]

Check this that I found, it implements a transparent window and inside it animates a ruler by draagging with touch. Note: the ruler is not an image, it is drawn in a Canvas, but you can configure the limits, for example 0 to 500.

https://github.com/MiHomes/RuleView

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kimmi Dhingra
Solution 2 MSD
Solution 3 android2003