Android开发3:项目目录介绍&HelloWorld
来源:互联网 发布:苹果6蜂窝移动数据设置 编辑:程序博客网 时间:2024/05/29 07:53
还是看的黎活明老师的Android视频。
上一张图先
1、gen/R.java ==== 该类由开发工具维护。大概就和做MFC开发的资源文件类似(自家观点)
package com.helloWorld; public final class R { public static final class attr { } public static final class drawable { public static final int icon=0x7f020000; } public static final class id { public static final int Button01=0x7f050000; public static final int Button02=0x7f050001; } public static final class layout { public static final int hello_world=0x7f030000; } public static final class string { public static final int Button01=0x7f040002; public static final int app_name=0x7f040001; public static final int hello=0x7f040000; } }
2、assert 目录 ==== 放在此文件夹下的文件,打包之时,会被原样打包。
3、res/drawable-hdpi、res/drawable-ldpi、res/drawable-mdpi 文件夹下都存放着一个.png图形文件,相当于资源吧,分别对应高低中像素的图标
4、res/layyout ==== 里面的 .xml 是界面布局文件 === 功能是类似于html
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" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <Button android:text="@string/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:text="@string/Button01" android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" /> LinearLayout>" encoding="utf-8"?> hello">Hello World, java! app_name">hello_world Button01">Clock me
5、res/values ===== 里面的 .xml 是一些字符串资源。和MFC类似
1.0
6、AndroidMainfest.xml ==== 功能清单文件
7、default.properties ==== 该文件不需开发者维护
MVC模式
C == Activity 类;V == .xml文件;M==自己写、业务层、业务代码
此种模式结构良好。
package com.helloWorld.stub;import javax.xml.parsers.SAXParserFactory;import com.helloWorld.R;import android.app.Activity;import android.app.AlertDialog;import android.os.Bundle;import android.os.Environment;import android.view.View;import android.widget.Button;public class java extends Activity {@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.hello_world);// Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);// SAXParserFactoryButton button = (Button) findViewById(R.id.Button01);button.setOnClickListener(new View.OnClickListener() {public void onClick(View v) {// Perform action on clickopenDialog();}});}public void openDialog() {AlertDialog.Builder builder = new AlertDialog.Builder(this);builder.setTitle("Hll www");builder.setMessage("Hello world/nwuhuiwen/n");builder.setNegativeButton("OK", null);builder.show();}}
setContentView() ; // 引用某个界面,显示界面。
五种布局:
1、LinearLayout、线性布局,一个元素独占一行
2、AbsoluteLayout、绝对布局(慎用)
3、RelativeLayout 、相对布局
4、TableLayout、表格布局
5、FrameLayout、帧布局。每个元素为一帧,产生动画效果
学习交流>^<欢迎拍砖
- Android开发3:项目目录介绍&HelloWorld
- 【Android】3、分析HelloWorld项目目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android 开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- Android开发之旅:HelloWorld项目的目录结构
- android项目目录介绍
- android项目目录介绍
- Qt中不规则窗体和部件的实现
- 怎样让用户在运行期实现设计期那样的界面设计方式
- 一种定位内存泄露的方法(Solaris)
- 使用RemObject SDK
- 潜能有多大,你知道吗
- Android开发3:项目目录介绍&HelloWorld
- HTTP协议中的Tranfer-Encoding:chunked编码解析
- 着色模式
- 转:Proguard使用教程
- 嵌入式系统的动态电源管理技术
- 《深入浅出Google Android》读书笔记
- Eight Important Life Skills
- 今天开始写博客
- 图片又被删除了,加好友和写迷你博客等的权限也没有了。无语!