android - 是否可以支持自定义扩展文件?
问题描述
如果我们有一个像.abc这样的自定义扩展名的文件,我可以用应用程序打开这个文件吗?
我们如何在“打开方式”选项的建议列表下显示我们的应用程序?
解决方案
你可以在你的AndroidManifest.xml
:
<activity ...>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file"
android:host="*"
android:pathPattern=".*\\.abc"
android:mimeType="*/*" />
</intent-filter>
</activity>
更多阅读:https ://developer.android.com/guide/components/intents-filters 。
推荐阅读
- datatable - 如何从两个列表中获取不同的数据到 PowerApps 中的图库?
- ios - UITableviewcell 是错误的数据
- telegram - 不返回个人资料照片
- python - PySimpleGUI,如何让字符串在新行上打印而不是切断它?
- python - 两个 MWE 展示了如何在 Python 中不导入东西,当您想在子目录中运行一个文件作为主要用于测试目的时
- mysql - 创建测试数据库时出错 - django、docker、mysql
- html - 有没有办法使用 CSS 或 jQuery 控制移动设备上的窗口高度?
- web - 使用 X-Requested-With: XMLHttpRequest: source 抑制 WWW-Authenticate?
- javascript - Jquery表单提交同时打开新标签
- node.js - Firebase Firestore:结合排除查询和排序的问题