Android面试题随笔1
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();
}
Android面试题随笔1的更多相关文章
- 【Android面试】Android面试题集锦 (陆续更新)(最新2012-6-18) eoe上看到的
===============eoeAndroid社区推荐:======================= 1.Android开发新浪面试题[开发者必看哦]下载地址 http://www.eoeand ...
- 安卓Android面试题大全
56个问题都是经常用到的,可以深入研究下,也是必须掌握的开发必备知识. 安卓Android面试题汇总 搜集了一些Android面试题目,供将要面试或者正在面试的朋友参考. 1, 谈谈你对Activit ...
- Android 面试题总结
Android 面试题总结(不断更新) 1.INETNT几种有关Activit的启动方式FLAG_ACTIVITY_BROUGHT_TO_FRONT 将ACTIVITY带到最前面FLAG_ACTIVI ...
- Android面试题整理【转载】
面试宝典(5) http://www.apkbus.com/android-115989-1-1.html 面试的几个回答技巧 http://blog.sina.com.cn/s/blog_ad ...
- 19、android面试题整理(自己给自己充充电吧)
(转载,出处丢失,请原作者原谅,如有意见,私信我我会尽快删除本文) JAVA 1.GC是什么? 为什么要有GC?GC是垃圾收集的意思(Gabage Collection),内存处理是编程人员容易出现问 ...
- Android面试题基础(转)
71道经典Android面试题和答案 1.下列哪些语句关于内存回收的说明是正确的? (b ) A. 程序员必须创建一个线程来释放内存 B.内存回收程序负责释放无用内存 C.内存回收程序允许程序员直接释 ...
- Android面试题(文章内容来自他人博客)
腾讯面试题 1.int a = 1; int result = a+++3<<2; 2.int a = 2; int result = (a++ > 2)?(++a):(a+=3); ...
- android面试题集1
Android 面试题(有详细答案) 附带答案,共100分 一.选择题(30题,每题1.5分,共45分) 1.java.io包中定义了多个流类型来实现输入和输出功能,可以从不同的角度对其进行分类,按功 ...
- Android面试题收集(有具体答案)
Android面试题目及其答案 1.Android dvm的进程和Linux的进程, 应用程序的进程是否为同一个概念 DVM指dalivk的虚拟机.每个Android应用程序都在它自己的进程中执行,都 ...
随机推荐
- hiho 1015 KMP
input 1<=T<=20 string1 1<=strlen(string1)<=1e4 string2 2<=strlen(string2)<=1e6 out ...
- CI 路由设置
$route['news/show/(:num)']='news/show/$1'; 前边是匹配 网址 后边是 指定控制器 在application/config/文件夹下有routes.p ...
- Tiny210编译和烧写u-boot步骤
当有多个交叉编译器是,不方便设置环境变量时,可以在编译命令中指定交叉编译器,具体如下: make ARCH=arm CROSS_COMPILE=/opt/FriendlyARM/toolschain/ ...
- linux下如何修改iptables开启80端口
linux下如何修改iptables开启80端口 最近在做本地服务器的环境,发现网站localhost能正常访问,用ip访问就访问不了,经常使用CentOS的朋友,可能会遇到和我一样的问题.开启了 ...
- angularjs三级联动
<div ng-controller="AjaxCtrl"> <h1>AJAX - Oriented</h1> <div> Coun ...
- 【记录】haphost免费vps初始配置
1.配置德国epel源 yum install yum-priorities rpm -Uvh http://ftp-stud.hs-esslingen.de/pub/epel/6/i386/epel ...
- 丑数<数学技巧>
题意:丑数就是质因子只有2,3,5 ,7,的数,另外1也是丑数.求第n(1=<n<=5842)个丑数,n=0,结束. 思路:.3.5或者7的结果(1除外).那么,现在最主要的问题是如何排序 ...
- JavaFX 2.0+ WebView /WebEngine render web page to an image
http://stackoverflow.com/questions/7796558/javafx-2-0-webview-webengine-render-web-page-to-an-image ...
- B. Qualifying Contest
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- windows下常用软件
1 pdf转word solid converter pdf 特点:功能强大,能转换页面页眉等,还有表格.