您的位置:首页 > 运维架构 > 网站架构

Android系统架构和程序结构简介

2013-04-14 15:04 387 查看
图示:



从图上来看,Android系统一共分了4层:

1、Linux内核:Android是运行在Linux kernel2.6之上,但是把linux内受GNU协议约束的部分做了取代,这样在Android的程序可以用于商业目的

2、中间件(包括核心库和运行时):媒体库、Sqlite、webkit、Dalvik虚拟机等

3、应用程序框架:Activity管理、消息管理器等

4、应用程序:这里指内置的应用程序,都使用Java编写

程序结构简介:

代码结构:

MainActivity.java:代码实现,例如:

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.i(tag,"onCreate");
}main.xml:有关界面布局和设计,例如:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
</LinearLayout>

AndroidManifest.xml:向Android系统描述所包含的组件、所实现的功能、能处理的数据等,例如:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.firstapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.firstapp.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: