android - 将菜单项添加到应用程序外部的弹出菜单
解决方案
我想你正在寻找这个
https://developer.android.com/guide/topics/ui/shortcuts
在AndriodManifest.xml
<meta-data android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
创建一个新的资源文件:res/xml/shortcuts.xml
在文件中定义快捷方式
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="compose"
android:enabled="true"
android:icon="@drawable/compose_icon"
android:shortcutShortLabel="@string/compose_shortcut_short_label1"
android:shortcutLongLabel="@string/compose_shortcut_long_label1"
android:shortcutDisabledMessage="@string/compose_disabled_message1">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.example.myapplication"
android:targetClass="com.example.myapplication.ComposeActivity" />
<!-- If your shortcut is associated with multiple intents, include them
here. The last intent in the list determines what the user sees when
they launch this shortcut. -->
<categories android:name="android.shortcut.conversation" />
</shortcut>
<!-- Specify more shortcuts here. -->
</shortcuts>
更多参考:https ://developer.android.com/guide/topics/ui/shortcuts/creating-shortcuts
推荐阅读
- c# - C#:FileStream.SetLength(long) 失败,并显示“由于文件系统限制,无法完成请求的操作”(在 Windows 10 Home、NTFS 上)
- android - Android Studio 3.1 - 插件 Android Support 中的异常。自上次清除以来发生 2 次。未读。禁用插件
- r - 根据字符值将数据帧拆分为子集
- symfony - 使用教义:数据库:创建时,如何创建具有特定追逐和排序规则的数据库?
- c# - 带方括号的模型绑定 POST 值
- r - 合并/加入不完全匹配列的数据框
- visual-studio-code - 在 VS Code Vim 中,当光标移到代码折叠上时,它们会自动打开。我怎样才能防止这种情况?
- apache-modules - 开发 Apache 模块 - 错误:取消引用指向不完整类型“apr_socket_t {aka struct apr_socket_t}”的指针
- python-3.x - 错误:没有名为 Elasticsearch 的模块
- mysql - 如何在 WHERE 子句中优化使用 COALESCE()?