新建HelloWorld工程项目目录说明:
工程目录:
按着下图顺序讲解
HelloWorld:
项目名
src:
自己编写的程序存放处
gen:
系统自动生成的文件R.java(和res资源文件关联,为其子文件drawable下每个图片及values下的键值自动添加唯一ID)
android.jar:
android开发依赖的库
assets:
存放图片,xml等资源文件,访问需要通过路径
res:
存放图片,xml等资源文件,访问不需要通过路径,R.java会自动生成唯一ID,可通过id访问
- drawable系列文件夹保存不同分辨率的图标,用于适应不同分辨率的手机
- values:存放键值对
- layout:存放布局样式
AndroidManifest.xml:
整个应用程序的配置文件。manifest元素仅能包含一个application元素,application元素中能够声明Android程序中最重要的四个组成部分,包括Activity、Service、BroadcastReceiver和ContentProvider,所定义的属性将影响所有组成部分。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloworld"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".HelloActivity"
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>
package=“com.example.helloworld” 包名
application 应用程序配置图标,标签名,标题,控件,启动入口等。
结语:
欲听后面精彩后事,请听下回分解。