2011-12-23 93 views
0

我想知道如何放大图像或点击时看到图像的全尺寸。 我想在屏幕上有四个小图像,所以当用户点击其中一个图像时,它会变大,以便他们可以正确地看到图像。如何在点击图片时放大图片?

我已经搜索了解如何做到这一点,但没有找到任何东西。

如果你可以请帮助我,我将不胜感激。

谢谢:)

回答

0

看看这个

onClick您的缩略图的方法,你可以以全屏模式启动新的活动:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 

并通过图像URI或一些东西,表示图像源到新的活动:在FullImage Activity类

Intent intent = new Intent(YouActivity.this, FullImage.class); 
intent.putExtra("imageUri", R.drawable.yourImage); // or the path to your image. 

ImageView icon = (ImageView) findViewById(R.id.myImage); 
BitmapFactory.Options options = new BitmapFactory.Options(); 
options.inTempStorage = new byte[3*1024]; 

Bitmap ops = BitmapFactory.decodeFile(path, options); 
// instead path you can get an image from previous activity. 

icon.setImageBitmap(ops);