如何在android中通过意图查看的图像之间滚动

如何在android中通过意图查看的图像之间滚动

本文介绍了如何在android中通过意图查看的图像之间滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个函数,使用以下Intent在单个视图中查看图像。

I have created a function to view images in a single view using following Intent.

Intent intent = new Intent();
                        intent.setAction(android.content.Intent.ACTION_VIEW);
                        intent.setDataAndType(Uri.fromFile(new File(temp.getPath())), "image/*");
                        startActivity(intent);

它会打开一个默认的图库应用程序来查看图像。但是我不能通过滑动屏幕来转到下一个图像,因为它通常发生在简单的图库应用程序中。我怎么能这样做?
场景是我有一个显示图片缩略图的网格视图。现在当有人点击它时,它会通过意图打开并以全屏显示但是要查看下一张图像,用户必须返回然后单击下一张图像。当一个人水平滑动屏幕时,切换图像的过程是什么。

It opens a default gallery app to view the images. However I cannot go to next image by sliding the screen as it normally happens in simple gallery app. How could I do it?The scenario is I have a grid view displaying thumbnails of pics. Now when somebody click on it, it is opened via intent and displayed in full screen but to see next image, user has to go back and then click the next image. What would be the procedure to switch images when a person slide the screen horizontally.

推荐答案

我得到了答案。实际上,我无法刷图像以查看下一个图像,因为默认的图库应用程序不知道该路径中存在更多图像。所以我使用广播意图通知了媒体解析器,然后我就可以刷图像。

I got the answer. Actually, I was not able to swipe the images to see next one because the default gallery app doesn't knew that more image exists in that path. So I notified the media resolver using broadcast intent and then I was able to swipe images.

这篇关于如何在android中通过意图查看的图像之间滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 16:10