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 应用程序启动器图标动画化?
基础教程推荐
- 如何使用 YouTube API V3? 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
