意图:删除始终/仅一次按钮

Mat*_*ler 6 android android-intent

我是Android开发的新手.

打开时可以取下两个按钮(始终/仅一次)Intent.ACTION_GET_CONTENT吗?

这是我目前的代码.

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent,PICK);
Run Code Online (Sandbox Code Playgroud)

Mat*_*ler 13

我找到了实现这个目标的方法:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
Intent openInChooser = Intent.createChooser(intent, "Open in...");
startActivityForResult(openInChooser,PICK);
Run Code Online (Sandbox Code Playgroud)

  • 迄今为止我发现的最佳解决方案谢谢 其他人建议创建一个自定义选择器,这显然是更多的工作.您应该将自己的答案标记为正确 (2认同)