How to change 'open' in gallery intent to

2019-05-26 20:08发布

I am using following intent to open gallery for picking multiple images and videos:

        Intent intent = new Intent();
        intent.setType("image/* video/*");
        intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "Select Images"), MULTIPLE_IMAGE_SELECT);

When the gallery is opened it looks like enter image description here

In the top it says 'open' i want to change it to 'done' or 'ok', how to achieve that? Thanks.

2条回答
该账号已被封号
2楼-- · 2019-05-26 20:57

EDIT: Changed "images/*" to "image/*"

Change this line intent.setType("video/*, image/*");

    Intent intent = new Intent();
    intent.setType("video/*, image/*");
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent, "Select Images"), MULTIPLE_IMAGE_SELECT);

Note: the EXTRA_ALLOW_MULTIPLE option is only available in Android API 18 and higher.

Can use custom lib. Like :

MultipleImagePick

MultiImageSelector

TelegramGallery

查看更多
闹够了就滚
3楼-- · 2019-05-26 21:04

When the gallery is opened it looks like

There are ~2 billion Android devices, spread across thousands of device models. Your Intent will open one of hundreds, if not thousands, of possible Android apps installed on those devices. It does not have anything specific to do with a "gallery" and certainly has nothing to do with whatever specific app you have in your screenshot. That just happens to be what shows up when you run your code on one specific device.

how to achieve that?

You write your own UI, rather than delegating it to somebody else's app. You do not control the UI of other developers' apps.

As Ahmad points out, there are many image picker libraries. Perhaps you could use one.

查看更多
登录 后发表回答