重用默认的 Android 图片库?
我在网上找到的用于显示图像库的所有示例都需要创建自定义适配器并进行大量手动工作。是否没有一个意图,我可以简单地传递路径或过滤器,以便重用默认图像库功能(显示缩略图、触摸以查看完整图片、共享选项等),但将结果限制到我的应用程序的存储目录?
All the examples I've found online for displaying a gallery of images require creating a custom Adapter and doing a ton of manual work. Is there not an Intent that I can simply pass a path or filter to in order to reuse the default image gallery functionality (display thumbnails, touch to view full pic, sharing options, etc) but limit the results to my application's storage directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
图库应用程序无权访问您应用程序存储目录中的文件。
图库应用程序不是 Android 操作系统的一部分。
图库应用程序通常会被设备制造商用自己的实现替换,因此即使您发现常规图库应用程序存在一些奇怪的后门来启用此功能,它也可能无法在许多设备上运行。
Android本身,在开源项目中,有两个图库应用程序(Gallery和Gallery3D),我不知道哪一个必然在任何设备上(如果有的话),也不知道哪一个是您认为提供“默认”的应用程序 是
但是,这些 Gallery 应用程序是开源的,因此欢迎您从其中复制您喜欢的任何代码。
The Gallery application has no rights to access files in your application's storage directory.
The Gallery application is not part of the Android operating system.
The Gallery application is routinely replaced by device manufacturers with their own implementations, so even if you found some screwy back-door to the regular Gallery application that enabled this, it probably would not work on many devices.
Android itself, in the open source project, has two Gallery applications (Gallery and Gallery3D), and I don't know which are necessarily on any device (if either) or which is the one that you think supplies "the default image gallery functionality".
However, those Gallery applications are open source, and so you are welcome to copy whatever code you like out of them.
您可以使用此代码来启动图库。
视频的代码是
图像的代码是
从图库中获取内容后,您可以从中做任何您想做的事情
如果您还需要询问其他问题,请发帖
谢谢
You can use this code to get the gallery started.
Code for Video is
code for Image is
And after getting the thing form the gallery , you can do whatever you want from it
Do post if you need to ask anything else
Thanks