android - 如何从 Android 文件选择器抽屉中删除项目?
问题描述
有没有办法从 android 文件选择器中删除“下载”、“图片”或“视频”部分?我知道例如可以使用以下方法删除 Google Drive:
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
但是你怎么能删除其他人呢?我正在三星设备上尝试它,阅读了一些帖子,我发现您可能必须为意图指定与供应商相关的配置。我的看起来像这样:
Intent intent = new Intent(Intent.OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.setType("*/*");
解决方案
您是否尝试过指定 MIME 类型?
尝试改变这个
intent.setType("*/*");
对此
intent.setType("image/*");
在这种情况下,您将看不到视频和音频。根据您的需要更改 MIME 类型。
推荐阅读
- python - loss.backward() 如何批量工作?
- python - 分解信号的每个周期
- laravel - Laravel 7:setUp() 中的单元测试集默认请求标头
- visual-studio - 如何为 Razor 文件中的符号 (@) 关闭 Visual Studio 背景突出显示?
- google-sheets - 在没有服务帐户的情况下向 Gsuite API 进行身份验证
- html - 使用 Twing 转义 HTML 标签
- html - 如何在 Materialise CSS 中调整导航链接的高度和面积?
- change-data-capture - 如何在 Scylla 中获取特定分区键的流 ID
- android - 图像到二进制值 - 像素值
- spring - Spring Boot / JPA / H2 - 找不到表