andorid 怎么把程序图标 贴加到 桌面上 而不是主菜单上面,越详细越好(新手)!

解决方案 »

  1.   

    可以在AndroidMenifest.xml中添加,你只要把图片导入到drawable中就可以了,接着在<application android:icon="@drawable/......."来引用就OK了
      

  2.   

    Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
         shortcutintent.putExtra("duplicate", false);       shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); 
    Parcelable icon = Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.icon);       shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);  
            shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(getApplicationContext() , test.class));  // 我的这个Activity名叫 test
            sendBroadcast(shortcutintent);   
    所以在我们的manifest.xml文件中,我们需要加入下面这段话:
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
    像网上说这样,但操作不成功啊。