Android2.33 应用程序工程目录分析
Android2.33 应用程序工程目录分析
HelloWorld程序工程目录结构1) src目录
2) gen目录
3) Android 2.3.3
4) assets目录
5) res/drawable目录
6) res/layout目录
7) res/values
8) AndroidManifest.xml
9) default.properties
10) proguard.cfg
HelloWorld程序工程目录结构
1) src目录
本目录下存放的Android应用程序的Java源代码,HelloWorldActivity类继承了Activity类,并覆盖onCreate()方法,在该方法中调用父类的构造方法,然后调用setContentView()方法展示视图界面。R.layout.main是R.java资源类中的布局属性。
- package com.test;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.Gravity;
- import android.view.View;
- import android.widget.Button;
- import android.widget.TextView;
- import android.widget.Toast;
- public class HelloWorldActivity extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- }
- }
2) gen目录
本目录存放的是工程资源索引文件 R.java,该类由系统自动生成,根据不同的资源类型又包含了不同的静态内部类。
a) attr静态类声明属性;
b) drawable静态类声明图片资源;
c) layout静态类声明布局文件;
d) string静态类声明字符串;
e) id静态类声明界面中使用的组件;
- /* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
- package com.test;
- public final class R {
- public static final class attr {
- }
- public static final class drawable {
- public static final int clwf=0x7f020000;
- public static final int icon=0x7f020001;
- }
- public static final class id {
- public static final int btn=0x7f050001;
- public static final int textview1=0x7f050000;
- }
- public static final class layout {
- public static final int main=0x7f030000;
- }
- public static final class string {
- public static final int app_name=0x7f040001;
- public static final int hello=0x7f040000;
- }
- }
|
评论暂时关闭