1.如何让一个应用在手机上产生两个或多个图标?

  在清单文件中的activity节点下配置如下:【5,7行代码】

  

  <activity
android:name=".MainActivity"
android:label="aaaa" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

  

  <activity
android:name=".SplashActivity"
android:label="bbbb" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

  该应用即会在手机出现两个相同的图标,均可打开此应用程序,而且应用名称可以不一样。

2. 请介绍下Android中常用的五种布局。

  介绍完5种布局【及使用方法或特色】后,要突出补充一些各自的特性才能出彩。

  FrameLayout主要用在游戏和视频应用上。TableLayout主要应用在证券和金融上。AbsoluteLayout主要应用在机顶盒【不用考虑屏幕适配】的应用上。

  常用的是RelativeLayout和LinearLayout。并且,首先考虑的是RelativeLayout,因为它的效率要比LinearLayout高,原因是一般情况下RelativeLayout的层级【hierarchyviewer.bat】比LinearLayout低。

3.Android测试步骤:

  清单文件总声明: <instrumentation  android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.zhu.mobilesafe" />

   application节点下声明:  <uses-library android:name="android.test.runner" />

  测试类继承 AndroidTestCase   extends AndroidTestCase

4.创建应用桌面快捷图标

  

 private void createHomeShortCut() {
boolean shortcut = sp.getBoolean("shortcut", false);
if(shortcut) //判断是否已经创建了桌面快捷图标
return;
Editor editor = sp.edit();
//发送广播的意图, 大吼一声告诉桌面,要创建快捷图标了
Intent intent = new Intent();
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
//快捷方式 要包含3个重要的信息 1,名称 2.图标 3.干什么事情
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "手机小卫士");
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher));
//桌面点击图标时启动并展示相应的activity。
Intent shortcutIntent = new Intent();
shortcutIntent.setAction("android.intent.action.MAIN");
shortcutIntent.addCategory("android.intent.category.LAUNCHER");
shortcutIntent.setClassName(getPackageName(), "com.zhu.mobilesafe.SplashActivity");
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
//发送广播意图
sendBroadcast(intent);
//修改应用设置为已创建快捷图标
editor.putBoolean("shortcut", true);
editor.commit();
}

最新文章

  1. BFC之浅析篇
  2. jq实现楼层切换效果
  3. 【NHibernate】配置- sql打印
  4. [Android] 获取音频输出getOutput
  5. SGU 106 The Equation 扩展欧几里得应用
  6. CentOS 7 服务器配置--配置iptables防火墙
  7. java简单数据类型转化
  8. protocol_v2.go
  9. VS2015 与 Git 的简单使用
  10. 【一】、搭建Hadoop环境----本地、伪分布式
  11. 求1+2+……+n的和
  12. 各种SQL查询技巧汇总 (转)
  13. SQL Server 性能优化详解
  14. Android -- View流程
  15. 【Unity笔记】用代码动态修改Animator状态机的状态
  16. CSS技巧:逐帧动画抖动解决方案
  17. javaweb 读取properties配置文件参数
  18. x-code的使用技巧心得
  19. u-boot 2011.09 使用自己的board 以及config.h
  20. windows下libcurl与zlib和ssl共同编译

热门文章

  1. 80-th Level Archeology
  2. hiho1246(数学求模)
  3. 用 Swift 编写面向协议的网络请求
  4. nand驱动移植
  5. android 检测是否插入U盘方法之一
  6. robot framework -记录关键字
  7. lucene-SpanFirstQuery 和SpanNearQuery 跨度查询
  8. eclipse Dynamic web project 工程目录
  9. java 内存分配全面解析
  10. posix信号量(sem_t)