【问题标题】:How to remove items from the Android file picker drawer?如何从 Android 文件选择器抽屉中删除项目?
【发布时间】:2020-04-21 09:47:44
【问题描述】:

有没有办法从 android 文件选择器中删除“下载”、“图片”或“视频”部分之类的项目? 我知道例如可以使用以下方法删除 Google Drive:

intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);

但是你怎么能删除其他人呢?我正在三星设备上尝试它,阅读了一些帖子,我发现您可能必须为意图指定与供应商相关的配置。我的看起来像这样:

Intent intent = new Intent(Intent.OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.setType("*/*");

【问题讨论】:

    标签: android android-intent android-fileprovider android-storage


    【解决方案1】:

    您是否尝试过指定 MIME 类型?

    尝试更改此设置

    intent.setType("*/*");
    

    到这里

    intent.setType("image/*");
    

    在这种情况下,您将看不到视频和音频。 根据需要更改 MIME 类型。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多