我確實需要在android設備上使用可滾動視圖的長尺圖片(如下所示)。在android滾動視圖上顯示較大的標尺
有人可以請同樣的建議做最好的方法嗎?
我以兩種方式試過,
起初,我試圖把圖片作爲背景,以滾動的看法,但作爲圖像太長/大,沒有工作。
目前我正在嘗試使用BitMap類來裁剪我的圖像並使用我想要顯示的部分。但是,每個卷軸上的問題都需要裁剪圖像的另一部分,並以同樣的方式顯示,以免在屏幕上反射。
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);
我很欣賞你的意見。
你有沒有嘗試過任何東西? –
我正在用我當前的代碼更新我的問題。 – Ketan
@AleksG請參閱更新 – Ketan