Android桌面图标快捷方式
Android 快捷方式 桌面图标
2023-09-27 14:22:49 时间
一、背景
长按桌面图标实现快捷方式最早是iOS提供的功能,而Android最早在Android 7.1版本也提供了对这方面的支持,于是在短时间内,像微信,支付宝,头条等流量级应用都提供了这方面的支持,如下图。
现在,长按桌面图标快捷方式已经是很成熟的功能,实现上也比较简单,主要用到的Api就是ShortcutManager。而在具体实现方案上,Android 又给出了两种实现方式,一种是静态,一种是动态。
二、静态方式
静态方式需要使用xml资源,以shortcuts标签的形式引入。对于静态方式,我们首先需要在res目录的xml目录下创建一个xml资源文件,如下所示。
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@mipmap/ic_shortcut_scan"
android:shortcutId="scan"
android:shortcutShortLabel="扫一扫">
<intent
相关文章
- Android 发布开源库到 JitPack (详细步骤)
- 腾讯Android自动化测试实战第2章
- android 适配器simpleadapter和baseadapter区别
- android布局 - fill_parent/match_paren/wrap_content的区别
- 《Android 应用案例开发大全(第二版)》——6.4节跨应用程序访问窗口
- 《Android游戏开发详解》——第2章,第2.3节编写第一个程序
- 在 Android 中创建静态应用程序快捷方式
- Android高斯模糊实现方案
- Android Studio 常见错误 之 一直处于 gradle download 状态,长时间出现超时,最后构建失败的问题的处理方法
- cocos2d-x 3.0 android mk文件 之 自己主动遍历*.cpp文件
- Android框架Volley使用:Json请求实现
- 安全更新不及时 将成Android致命伤