我希望使用自己的快捷方式,根据快捷方式类型打开特定的活动。
Create an xml named shortcuts.xml
under res, inside xml directory and add following code in it: (to create static shortcuts)
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@mipmap/ic_launcher"
android:shortcutDisabledMessage="@string/static_shortcut_disabled_message"
android:shortcutId="static"
android:shortcutLongLabel="@string/static_shortcut_long_label"
android:shortcutShortLabel="@string/static_shortcut_short_label">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="<Fully_Qualified_Activity_Name>"
android:targetPackage="Package_Name_Of_Activity" />
</shortcut>
</shortcuts>
在 Manifest.xml
文件中,为您的活动添加以下元数据标记:
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
长按应用程序图标进行测试。
”
和 “
,这应该是 "
吗? - jmattheis