zoukankan      html  css  js  c++  java
  • 总结(创建快捷方式等)

    1、创建快捷方式

      

    public void checkShortCut() {
    
            SharedPreferences sp = PreferenceManager
                    .getDefaultSharedPreferences(this);
            // 是否在桌面上添加了快捷方式
            boolean never_check_shortCut = sp.getBoolean("never_check_shortCut",
                    false);
            // 存在快捷方式或者不允许添加,return
            if (never_check_shortCut) {
                return;
            } else {
                addShortcut();
                // 保存已经添加了快捷方式的信息,以便程序下次启动的不再提示
                Editor editor = sp.edit();
                editor.putBoolean("never_check_shortCut", true);
                editor.commit();
            }
        }
    private void addShortcut() {
            Intent shortcut = new Intent(
                    "com.android.launcher.action.INSTALL_SHORTCUT");
    
            // 快捷方式的名称
            shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
                    getString(R.string.app_name));
            shortcut.putExtra("duplicate", false); // 不允许重复创建 
            Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
            shortcutIntent.setClassName(this, SplashActivity.class.getName());
            shortcutIntent.addCategory(Intent.CATEGORY_LAUNCHER);
            shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
            // 快捷方式的图标
            ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(
                    this, R.drawable.icon);
            shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes);
    
            sendBroadcast(shortcut);
        }

    2、设置ListView不显示分割线

      android:divider="@null"

  • 相关阅读:
    nginx 启动相关的
    爬取豆瓣读书/文件存储数据/数据库存储数据
    python Web 开发三剑客比较
    scrapy
    爬虫自动登录抽屉
    组合搜索
    html瀑布流
    Ajax上传文件/文件预览
    Form组件
    django分页
  • 原文地址:https://www.cnblogs.com/snowspace/p/3297806.html
Copyright © 2011-2022 走看看