Q
创建应用程序图标
1
A
回答
0
创建你的图标,把它放在绘制文件夹,然后在你的清单...
<application
android:icon="@drawable/your_icon"
android:label="@string/app_name" >
+1
-1仔细阅读问题。他想在主屏幕上创建应用程序快捷方式。 – 2012-04-27 07:49:11
+0
嗯我不知道为什么downvote?基本上这似乎是答案 – 2012-04-27 07:49:22
+0
@PareshMayani也许我误解了这个问题,我的编辑改变了它? – 2012-04-27 07:50:48
2
添加快捷方式
private void addShortcut(){
Intent shortcutIntent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
// Shortcut name
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
shortcutIntent.putExtra("duplicate", false);
ComponentName comp = new ComponentName(this.getPackageName(), "."+this.getLocalClassName());
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp));
// Shortcut icon
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes);
sendBroadcast(shortcutIntent);
}
方法removeing快捷
方法private void delShortcut(){
Intent shortcut = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
// Shortcut adı
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
String appClass = this.getPackageName() + "." +this.getLocalClassName();
ComponentName comp = new ComponentName(this.getPackageName(), appClass);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp));
sendBroadcast(shortcut);
}
种上的OnCreate
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
delShortcut();
addShortcut();
权限调用方法添加快捷方式
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"></uses-permission>
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
相关问题
- 1. iTunesConnect拒绝应用程序图标 - 无法创建应用程序图标
- 2. 如何创建标签应用程序?
- 3. Xcode 7创建正确的应用程序图标图像
- 4. 使用JWS JNLP为JavaFX应用程序创建桌面图标
- 5. 为Android应用程序创建类图
- 6. 为iPhone应用程序创建类图
- 7. 如何创建Windows 10 iot核心应用程序图标
- 8. 创建应用程序图标的最佳方法
- 9. 创建图标以启动应用程序(iPhone/iPad)
- 10. 为Skype应用程序创建图标,如在Skype中
- 11. 如何创建基本的托盘图标应用程序?
- 12. 新应用程序的图标 - 创建或购买?
- 13. 如何在gcc创建的应用程序中添加图标?
- 14. 创建应用程序栏图标(Expression Design,Windows Phone 7)
- 15. 当我运行应用程序时没有创建Android图标
- 16. 在应用程序的图标上创建通知
- 17. 在WP7应用程序中创建平铺图标
- 18. 是可以创建一个Web应用程序的图标?
- 19. 如何为Launcher应用程序图标创建透明背景
- 20. 创建子应用程序
- 21. 上创建应用程序
- 22. 创建Android应用程序
- 23. 创建应用程序
- 24. 创建WiFi应用程序
- 25. Jawbone创建应用程序
- 26. 创建Web应用程序
- 27. 创建Facebook应用程序
- 28. 创建Google+应用程序
- 29. 创建Twitter应用程序
- 30. 创建Facebook应用程序
欢迎SO!请在此搜索现有问题,因为同一问题已存在许多QA。 – 2012-04-27 07:49:50