没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Android 学习笔记总结
第一步:
Android(1) - 在 Windows 下搭建 Android 开发环境,以及 Hello World 程序
搭建 的开发环境,以及写一个简单的示例程序
在 下搭建 开发环境
项目的目录结构说明
写一个简单的 程序
一、在 下搭建 开发环境
、安装
、安装 !
"
#、安装 $"
"%
&、打开 $",并安装其 插件(')
打开菜单 (()*(+,-,!.(,在 (/!.(中加入地址
)%%"",然后安装 ''
0、新建 项目
(-()*1",1"-)项目名称;23'%)编译项目的 !版本;"
)程序名称;1"%)包名;4!5)程序所支持的最低 !版本代号( 对应 ,#
对应 0,&对应 )
、运行 项目
打开菜单 (63()*(6378%3()*-3""8%3,设置启动项目名称,在 选项
卡中选择启动项目,在 '%选项卡中设置模拟器
9、创建使用模拟 !卡
创建 !卡,运行类似如下命令:")"0 4::"%
模拟器中使用 !卡,在项目配置的 '%选项卡的 ($37;<(框中输入
类似如下参数:)"::"%
=、配置模拟器
运行类似如下命令:"))0))% 。或者直接在菜单 (()*
(54%(中配置模拟器
>、浏览模拟 !卡中的内容
调试程序,在 4!中选择 (?$@(,在其中的 "目录下就是模拟 !卡中的内容
A、查看日志 ;%7
)*!5)*<)*)*;%7
、在模拟器中安装卸载
安装 运行类似如下命令:/;卸载 运行类似如下命令:/3
"%(注:这里的参数是需要卸载的包名)
、反编译 程序
解压 文件,取出其中的 "@,文件,运行类似如下命令:@3@)"@*
3@(其意思是将 "@3出来,并将反编译后的代码保存到指定的文本文件中)
#、人品不好是出现的某些错误的解决办法
如果出现类似如下的错误等
"8"8
7..
解决办法:1")*7
出现 !7;AB(一直卡在 AB)
解决办法:1")*去掉 233"C前面的勾
&、查看 !源代码
先想办法搞到源代码,如这个地址 %%/",,然后将其解压到 !根路径下
的 3"文件夹内即可
二、项目的目录结构
、")用于放置源程序
、%)自动生成 6文件,用于引用资源文件(即 目录下的数据)
#、)用于放置原始文件,不会对此目录下的文件做任何处理,这是其与 目录不同的地方
&、/)用于放置图片之类的资源;C3)用于放置布局用的 @文件;3)用于放置一
些常量数据
0、4.@)程序的清单文件,相当于配置文件,配置应用程序名称、图标、
"C、!"、6" 等
三、程序
、C3@
代码
<?xmlversion="1.0"encoding="utf-8"?>
<!--
设置 ID的方式:ID 前加前缀,@+id/
引用资源文件内字符串资源的方式:指定的资源名称前加前缀,@string/
-->
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/layout"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/txt"
/>
</LinearLayout>
、3%@
代码
<?xmlversion="1.0"encoding="utf-8"?>
<resources>
<stringname="hello">layout直接调用 values中的字符串</string>
<stringname="hello2">编程方式调用 values中的字符串</string>
<stringname="app_name">webabcd_hello</string>
</resources>
#、/目录下放置一个名为 "%的图片文件
&、4.@
代码
<?xmlversion="1.0"encoding="utf-8"?>
<manifestxmlns:android="http://schemas.android.com/apk/res/android"
package="com.webabcd.hello"
android:versionCode="1"
android:versionName="1.0">
<applicationandroid:icon="@drawable/icon"android:label="@string/
app_name">
<activityandroid:name=".Main"
android:label="@string/app_name">
<intent-filter>
<actionandroid:name="android.intent.action.MAIN"/>
<categoryandroid:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<uses-sdkandroid:minSdkVersion="3"/>
</manifest>
0、4
代码
packagecom.webabcd.hello;
importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.widget.LinearLayout;
importandroid.widget.TextView;
publicclassMainextendsActivity{
/**Calledwhentheactivityisfirstcreated.*/
@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
//将指定的布局文件作为 Activity所显示的内容
setContentView(R.layout.main);
//动态地在指定的容器控件上添加新的控件
TextViewtxt=newTextView(this);
txt.setText("动态添加控件");
//setContentView(txt);
((LinearLayout)this.findViewById(R.id.layout)).addView(txt);
//引用资源文件内的内容作为输出内容
TextViewtxt1=(TextView)this.findViewById(R.id.txt);
txt1.setText(this.getString(R.string.hello2));
}
}
)布局;C3和菜单43
介绍
在 中各种布局的应用,以及菜单效果的实现
各种布局方式的应用,?;C3D;;C3D'/;C3D/3;C3D
6;C3,,
为指定元素配置上下文菜单,为应用程序配置选项菜单,以及多级菜单的实现
、各种布局方式的演示
C3@
代码
<?xmlversion="1.0"encoding="utf-8"?>
<!--
layout_width-宽。fill_parent:宽度跟着父元素走;wrap_content:宽度跟着本身的内容
走;直接指定一个 px值来设置宽
layout_height-高。fill_parent:高度跟着父元素走;wrap_content:高度跟着本身的内容
走;直接指定一个 px值来设置高
-->
<!--
LinearLayout-线形布局。
orientation-容器内元素的排列方式。vertical:子元素们垂直排列;horizontal:子元
素们水平排列
gravity-内容的排列形式。常用的有 top,bottom,left,right,center等,详见文
档
-->
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"android:gravity="right"
android:layout_width="fill_parent"android:layout_height="fill_parent">
<!--
FrameLayout-层叠式布局。以左上角为起点,将 FrameLayout内的元素一层覆盖一层地显
示
-->
<FrameLayoutandroid:layout_height="wrap_content"
android:layout_width="fill_parent">
<TextViewandroid:layout_width="wrap_content"
android:layout_height="wrap_content"android:text="FrameLayout">
</TextView>
<TextViewandroid:layout_width="wrap_content"
android:layout_height="wrap_content"android:text="FrameLayout"
>
</TextView>
</FrameLayout>
<TextViewandroid:layout_width="wrap_content"
android:layout_height="wrap_content"android:text="@string/hello"/>
剩余63页未读,继续阅读
happylfen124
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页