简体   繁体   English

如何设置使用默认 Android 图像查看器查看 Bitmap 的意图?

[英]How to set up intent for viewing Bitmap with default Android image viewer?

What I am trying to do is to download image from web and show it on screen with zoom/pan capability.我想要做的是从 web 下载图像并在屏幕上显示具有缩放/平移功能。 I've successfully downloaded image into Bitmap instance, but ImageView doesnt have zooming feature.我已成功将图像下载到 Bitmap 实例中,但 ImageView 没有缩放功能。 So instead I'm willing to present it with default viewer which has zoom/pan features.因此,我愿意使用具有缩放/平移功能的默认查看器来展示它。

How do I set up Intent to view Bitmap with default Android image viewer?如何设置使用默认 Android 图像查看器查看 Bitmap 的意图? I know Intents action should be View:我知道 Intents 操作应该是 View:

    intent.setAction(Intent.ACTION_VIEW);

But how to provide data for Intent when image is in Bitmap instance myBitmap ?但是当图像在 Bitmap 实例myBitmap中时,如何为 Intent 提供数据?

If you want to use Android default image viewer use below code如果您想使用 Android 默认图像查看器,请使用以下代码

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("string Uri")));

or if you want to show Imageview with zoom In/Out functionality refer below question Android Multi touch zooming或者,如果您想显示 Imageview 具有放大/缩小功能,请参阅下面的问题Android 多点触控缩放

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM