使用 GalleryView 选择多个图像 [英] Select Multiple Images Using GalleryView

查看:29
本文介绍了使用 GalleryView 选择多个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道 Android 是否内置了代码,以便我可以在画廊视图中选择多个图像,然后将这些图像作为文件名导出到字符串数组中(例如/sdcard/~f1.jpg、/sdcard/~f2.jpg,...).

I was just wondering if Android had built in code so that I could select multiple images in a gallery-view and then have those images exported as filenames in a string array(ex /sdcard/~f1.jpg, /sdcard/~f2.jpg,...).

再次感谢任何帮助!只是为了让你们知道,我使用的图库工作正常(对于一张图像)——因为它正确导出了文件名.只需要知道是否有一种简单的方法可以选择多个并导出它们.再次感谢!

Again any help is appreciated! Just to let you guys know, the gallery I'm using works fine (for one image) -- as in it exports the filename correctly. Just need to know if there is an easy way to select multiples and export them. Thanks again!

推荐答案

图库小部件默认不支持多选.我相信其中之一是 ListView,使用choiceMode 属性(设置为 2 表示多选).

The gallery widget doesn't support multiple selection by default. I believe the one one which does is ListView, using the choiceMode attribute (set to 2 for multiple selection).

您可以尝试将 ListView 扩展到您自己的自定义视图中,根据需要设置图像格式.

You could try extending ListView into your own custom view which formats the images as you need.

另一种选择是扩展图库视图并添加您自己的代码以允许多选.您需要覆盖相当多的方法以允许进行多项选择.查看 android 源代码,看看他们是如何做到的.

The other option is to extend the gallery view and add in your own code to allow multiple selection. You would need to override quite a few methods to allow for multiple selection. Take a look at the android source code to see how they did it.

这篇关于使用 GalleryView 选择多个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆