Android:点击放大图像

发布于 2024-12-12 11:24:04 字数 80 浏览 2 评论 0原文

我正在制作一个Android应用程序,其中需要,当用户单击图像时我希望它以全屏方式打开。我该如何实现这个目标? 有人能帮我解决这个问题吗? 谢谢

i am making an android app in which in need that , when the user clicks image I want it to open up in the full screen. How do I accomplish this?
Can anyone help me over this?
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ま昔日黯然 2024-12-19 11:24:04

获取所选图像的图像 ID,然后使用 Intent 将该图像 ID 传递给 FullImage 活动。使用 ImageView 在该活动中显示图像。

按照这样的编码

Activity1 // 其中图像可用..

Intent fullScreenIntent = new Intent(v.getContext(),Full.class); 
fullScreenIntent.putExtra(Full.class.getName(),imageId);

在 FullImage Activity.. 添加此编码。

int imageId1 = intent.getIntExtra(Full.class.getName(),default1); 
InputStream is = this.getResources().openRawResource(imageId1);
Bitmap originalBitmap = BitmapFactory.decodeStream(is);
ImageView myimage = (ImageView) findViewById(R.id.ImageView01);
myimage.setImageBitmap(originalBitmap);
myimage.setScaleType(ScaleType.MATRIX);  

Get image Id of selected image then pass that image id to FullImage activity using Intent. Display image in that activity using ImageView.

follow coding like this

Activity1 // where images are available..

Intent fullScreenIntent = new Intent(v.getContext(),Full.class); 
fullScreenIntent.putExtra(Full.class.getName(),imageId);

in the FullImage Activity..add this coding.

int imageId1 = intent.getIntExtra(Full.class.getName(),default1); 
InputStream is = this.getResources().openRawResource(imageId1);
Bitmap originalBitmap = BitmapFactory.decodeStream(is);
ImageView myimage = (ImageView) findViewById(R.id.ImageView01);
myimage.setImageBitmap(originalBitmap);
myimage.setScaleType(ScaleType.MATRIX);  
怪我太投入 2024-12-19 11:24:04

你可以用一种简单的方式做到这一点。

如果您的活动有其他视图,只需将其可见性设置为消失,并使 imageview 填充 Click 事件的父级。

you can do it in an easy way.

If you have other views on your activity just set their Visibility to gone and make imageview fill parent on Click event.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文