意图获取多张图片意图、多张、图片

2023-09-12 08:36:31 作者:时间覆盖一切

有意向申请获得多张图片?

Is there an intent requesting to get multiple images?

我们都知道 Intent.ACTION_PICK Intent.ACTION_GET_CONTENT 获取一幅图像。另外我们的应用程序注册为IntentFilter的为 android.intent.action.SEN D和 android.intent.action.SEND_MULTIPLE。

We are aware of Intent.ACTION_PICK or Intent.ACTION_GET_CONTENT for getting a single image. Also our app registers as IntentFilter for android.intent.action.SEND and android.intent.action.SEND_MULTIPLE.

不过,我们希望我们的应用程序,以充分利用库的应用程序一样挑选多张图像。是否有一个意图是什么?

However, we would like our app to make use of Gallery like applications to pick multiple images. Is there an intent for that?

推荐答案

我也想为意向中的Andr​​oid挑选多张图片,但我failed.I碰到定制画廊自定义主题。

I also wanted Intent for picking multiple images in android but I failed.I came across custom gallery with custom theme.

在这里看看 MultipleImagePick 挑选单一的形象,并选择多个图片,你也可以根据自己的应用程序更改主题。

Look at here MultipleImagePick to pick single image and to pick multiple image and also you can change theme according to your app.

更新

感谢@ 阳光指导我限制最大图像的选择。我张贴低于code帮助任何人其他人,请接受这个编辑。

Thanks @sunshine for guiding me to limit maximum images selection. I am posting code below to help anyone other people, please accept this edit.

in CustomGalleryActivity.java 

AdapterView.OnItemClickListener mItemMulClickListener = new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> l, View v, int position, long id) {
            if (adapter.getSelected().size() >= MAX_IMAGE_SELECTION_LENGTH) {
                Toast.makeText(getApplicationContext(), "maximum items selected", Toast.LENGTH_LONG).show();
            } else {
                adapter.changeSelection(v, position);
            }

        }
    };