01_03_say_hello_to_Android
1、创建一个Android应用程序的步骤
2、Android应用程序的目录结构
src目录:存放源代码
gen目录:由SDK自动产生。其中R.java文件是资源文件
-
/* AUTO-GENERATED FILE. DO NOT MODIFY.
-
*R.java文件
-
* This class was automatically generated by the
-
* aapt tool from the resource data it found. It
-
* should not be modified by hand.
-
*/
-
-
package com.lwb.myhelloword;
-
-
public final class R {
-
public static final class attr {
-
}
-
public static final class dimen {
-
/** Default screen margins, per the Android Design guidelines.
-
-
Customize dimensions originally defined in res/values/dimens.xml (such as
-
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-
-
*/
-
public static final int activity_horizontal_margin=0x7f040000;
-
public static final int activity_vertical_margin=0x7f040001;
-
}
-
public static final class drawable {
-
public static final int ic_launcher=0x7f020000;
-
}
-
public static final class id {
-
public static final int action_settings=0x7f080000;
-
}
-
public static final class layout {
-
public static final int activity_hello=0x7f030000;
-
}
-
public static final class menu {
-
public static final int hello=0x7f070000;
-
}
-
public static final class string {
-
public static final int action_settings=0x7f050001;
-
public static final int app_name=0x7f050000;
-
public static final int hello_world=0x7f050002;
-
}
-
public static final class style {
-
/**
-
Base application theme, dependent on API level. This theme is replaced
-
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-
-
-
Theme customizations available in newer API levels can go in
-
res/values-vXX/styles.xml, while customizations related to
-
backward-compatibility can go here.
-
-
-
Base application theme for API 11+. This theme completely replaces
-
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-
-
API 11 theme customizations can go here.
-
-
Base application theme for API 14+. This theme completely replaces
-
AppBaseTheme from BOTH res/values/styles.xml and
-
res/values-v11/styles.xml on API 14+ devices.
-
-
API 14 theme customizations can go here.
-
*/
-
public static final int AppBaseTheme=0x7f060000;
-
/** Application theme.
-
All customizations that are NOT specific to a particular API-level can go here.
-
*/
-
public static final int AppTheme=0x7f060001;
-
}
-
}
Android 4.2目录:
其中有这样的一个android.jar 路径是在D:\swpaket\study\adt-bundle-windows-x86-20130729\adt-bundle-windows-x86-20130729\sdk\platforms\android-18\android.jar
表明:android应用的所有类文件均来源于android.jar中(这个含有很多的包)
Android Private Libraries目录(该目录下有两个目录)
Android Dependencies目录:
asserts目录:(放置任何文件)
res目录:(在该目录下放置的任何文件,均会在R.java中产生一个id,可以通过这个id来使用这个文件)
drawable(-hdpi,-ldpi,-mdpi,三个版本的分辨率的图片等)目录:
layout:(放置布局布局文件main.xml,控制各种控件在Activity中的布局)
values:(如:string.xml)
如:string.xml 里边的键值也会在R.java中有唯一的id号
-
<?xml version="1.0" encoding="utf-8"?>
-
<resources>
-
-
<string name="app_name">myhelloword</string>
-
<string name="action_settings">Settings</string>
-
<string name="hello_world">Hello world!</string>
-
-
</resources>
3、AndroidManifest.xml文件的作用 (
-
Manfiest的意思:
-
n. 载货单,货单;旅客名单
)
AndroidManifest.xml整个程序的配置文件
-
<?xml version="1.0" encoding="utf-8"?>
-
<manifest xmlns:android=""
-
package="com.lwb.myhelloword"
-
android:versionCode="1"
-
android:versionName="1.0" >
-
-
<uses-sdk
-
android:minSdkVersion="10"
-
android:targetSdkVersion="17" />
-
-
<application
-
android:allowBackup="true"
-
android:icon="@drawable/ic_launcher"
-
android:label="@string/app_name"
-
android:name="com.lwb.myhelloword.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>
4、Android相关资源文件的作用
阅读(367) | 评论(0) | 转发(0) |