Android Programming: Pushing the Limits -- Chapter 3: Components, Manifests, and Resources

Android Components
Manifest文件
Resource and Assets

v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}

Normal
0
false

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}

Android Components:

@、Activity、Services、BroadcastReceivers、ContentProviders、Application。

@、Activity

1、  负责user interface。

2、  Android 3.0(Honeycomb)开始,使用Fragment实现界面动态调整。

@、Services

1、  实现后台执行操作。

@、BroadcastReceivers

1、  监听系统事件。

@、ContentProviders

1、  存储数据。

@、Application

1、开发前,使用组件来构造应用的框架。暂时只描述组件的功能,而不需完整设计好。

Android Programming: Pushing the Limits -- Chapter 3: Components, Manifests, and Resources

Manifest文件:

@、<manifest>的属性可以定义:应用的包名,唯一标志符(package),应用运行的Linux用户id(sharedUserId)和名称(sharedUserLabel),版本信息(versionCode, versionName),安装位置(installLocation)。

@、<user-feature>描述安装此应用需要的条件。用于Google Play进行过滤。

You can find a complete list of all the standard features in Android at

http://developer.android.com/guide/topics/manifest/uses-feature-element.html#features-reference

@、<supports-screens>描述安装此应用需要的屏幕大小。

@、<uses-sdk>描述应用的Android版本(minSdkVersion, maxSdkVersion, targetSdkVersion)。如果可能的话,最好不指定maxSdkVersion。

You can find a complete list of all API levels and which Android version they represent at

http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

@、<application>

name:当使用自定义的应用类时,可通过此属性指定对应的类名,否则不需要使用此属性。

backupAgent:指定用来备份的类,用来帮助用户进行应用迁移而不丢失应用的数据。

largeHeap:最大内存需求,当设备内存小于此设置时,系统极可能就会终止应用,不建议使用此属性。

process:具有同个用户id(在<manifes>中指定的sharedUserId)的应用,如果此属性设置一样,则会强制使用相同的进程。这种情况,如果一个应用崩溃将影响使用同一进程的其他应用。

theme:设置整个应用的主题。注:Activities可以独立设置主题。

@、组件属性

enabled:如果设置为false,Activities不会显示;Services不会对startService方法作出反应;BroadcastReceivers不会监听BroadcastIntents;ContentProviders不会回应ContentResolver。

exported:如果设置为false,则不会暴露给系统的其他应用。

@、<intent-filter>依赖因素:<action>、<category>、<data>

You can read more about Intents and Intent resolution for Android at

http://developer.android.com/guide/components/intents-filters.html

Resources and Assets:

@、You can find a list of all the resource qualifiers, their order of precedence, and their meaning at http://developer.android.com/guide/topics/resources/providing-resources.html#table2

@、You can find detailed rules on formatting resource strings in the JavaDoc for the java.util.

Formatter class at http://developer.android.com/reference/java/util/Formatter.html

@、<plurals>,在代码中通过getQuantityString()获取值。

@、Localization:

You can access the Google Translator Toolkit at http://translate.google.com/toolkit

@、A great site for finding the mobile country codes (MCC) and mobile network code (MNC) values for various carriers and countries is www.mcc-mnc.com

@、从Android 2.3开始,resource文件大小限定为1M。而在assets目录下的没有限制。

v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}

Normal
0
false

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}

上一篇:UVa 11059 - Maximum Product 最大乘积【暴力】


下一篇:Android Programming: Pushing the Limits -- Chapter 1: Fine-Tuning Your Development Environment