- 1、本文档共5页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Android实验二-UI界面开发
Android 实验设计
实验二:界面设计:控件与布局
08计应胡巍巍
【目的】
Android编程基础,UI设计。
【要求】
了解Android编程原理
掌握界面控件设计
掌握控件的事件处理编程
【原理】
1.熟悉各种控件的基本功能
常用控件包括:TextView,EditText,Button,ImageView:
ImageButton,ProgressBar,Radio button:
2.了解各种布局Layout的应用
多种Layout: AbsoluteLayout FrameLayout GridView
LinearLayout ListLayout RadioGroup
TableLayout ………
【实验过程】
新建一个Project,并对其布局文件进行简单修改。
New 一个 Android project:
Project Name: Practice ,Application name:Project ,Build Target勾选Android 2.2,Package name:com.eoeAndroid.Practice ,Create Activity:Practice ,Min SDK Version:8. 然后点击Next→Finish。
Finish后,Eclipse Platform左边Package Explorer栏中出现了我们刚才新建的project。根据实验要求在layout?main.xml中修改布局文件(我选的是相对布局relative layout),增加所需控件。分析实验要求后,对要求添加的控件按照从上到下,从左到右的顺序添加。布局xml实现如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="/apk/res/android"
android:orientation="horizontal" //默认控件水平排列
android:layout_width="fill_parent" //相对布局的有效范围
android:layout_height="fill_parent"
android:background="#ffffff"> //背景颜色
<TextView android:id="@+id/text1" //第一个文本控件
android:layout_width="wrap_content" //控件宽度和高度有文本决定
android:layout_height="wrap_content"
android:text="@string/hello"/>//文本内容:hello所定义的字符串
<TextView android:id="@+id/text2" //第二个文本控件
android:layout_width="wrap_content" //同上
android:layout_height="wrap_content"
android:layout_below="@id/text1"//这里实现text2布局在text1的下方
android:text="Hello,It's Huweiwei's Android Project !"//内容
android:textStyle="bold"/>//文本字体样式,这里是粗体
<EditText android:id="@+id/ET1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/text2"
android:hint="Input what you want to say to TA"
android:shadowColor="#ff0000"/>//边框阴影眼测
<TextView android:id="@+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/ET1"
android:text="Do you miss Miss TA^0^?"
android:textStyle="bold"/>
<
1亿VIP精品文档
相关文档
最近下载
- 《刻画空间点、线、面位置关系的公理(1)》示范公开课教案【高中数学必修第二册北师大】.docx
- 《信息技术与小学学科教学的有效整合研究结题报告》.doc
- 三自由度并联机械手的设计.doc
- 双减背景下单元整体作业分层设计案例 部编版语文七年级下册第四单元 中华美德 修身正己.doc
- 小学生禁毒日教育宣传 ——主题班会课件(共16张PPT).pptx
- 注音版日有所诵一年级上册第五版.ppt
- 部编版初中语文九年级下册第二单元作业设计.docx VIP
- 幼儿园施工组织设计完整版.doc VIP
- 2024届大湾区普通高中毕业班联合模拟考试(二) 二模 政治试卷(含官方答案).docx
- 简约马术比赛运动宣传PPT模板.pptx
文档评论(0)