Is it is possible to make android app launcher icon animated when i click on it?(当我单击它时,是否可以使 android 应用程序启动器图标动画化?)
问题描述
当我点击应用启动器图标时,我的应用需要一个功能,它应该是动画的.
I need a functionality for my app when i click on app launcher icon it should be animated.
我还需要它的点击事件,所以我可以对其进行任何操作.
Also I need click event of it so i can do whatever operation on that.
尝试过:
我已经尝试过小部件,但我不知道具体是如何做到的.
I have tried widget but i don't have an idea how exactly do that.
如果您对此有任何建议或任何想法如何制作此类功能,请帮助我.
Please help me if you have any suggestion for this or any idea how to make this type of functionality.
推荐答案
我想出了如何像其他应用一样在应用图标上实现动画.
I figured it out how to achieve animation on app icon like other app doing.
- 创建快捷方式或您的应用需要此权限.
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
你需要通过指定
Theme.Translucent.NoTitleBarTheme来创建透明Activity.当用户点击应用程序的快捷方式时,该活动将负责我们想要实现的动画.
you need to create transparent activity by specifying
Theme.Translucent.NoTitleBarTheme. This activity will responsible for animation that we want to achieve when user click on shortcut of app.
现在我们可以通过计算快捷方式的位置来在快捷方式图标上显示动画.这可以使用 ShortcutInfo 和 ShortcutManager 来完成.为了支持所有 android 版本,有 ShortcutInfoCompat 类可用.找到更多这里.
now we can show animation over shortcut icon by computing position of shortcut. this can be done using ShortcutInfo and ShortcutManager. To give support all android version there isShortcutInfoCompatclass available. find more here.
这篇关于当我单击它时,是否可以使 android 应用程序启动器图标动画化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:当我单击它时,是否可以使 android 应用程序启动器图标动画化?
基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
