- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
第3讲android用户界面布局(layout)
作业二: 编写一个有两个Activity的应用程序,在第一个Activity显示一个登陆界面,至少包含如下控件:2个TextView、2个EditText、1个Button 将第一个Activity中输入到EditText的信息显示到第二个Activity的TextView中 至少使用两种布局方式来摆放第一个Activity中的控件,并且控件要排列整齐,符合基本用户习惯 作业在3月19日通过微博提交,要求提交源代码(在源代码中注明班级、姓名和学号)和运行结果的截图 Padding(填充) The padding is expressed in pixels for the left, top, right and bottom parts of the view. Padding can be used to offset the content of the view by a specific amount of pixels. Margin--ViewGroup.MarginLayoutParams UI示例 main.xml RelativeLayout A Layout where the positions of the children can be described in relation to each other or to the parent. RelativeLayout.LayoutParams RelativeLayout示例 APIDemos:RelativeLayout1~RelativeLayout2, BaseLine6~BaseLine7 TableLayout 表格布局可将视图按行、列排列. TableLayout布局参数 This set of layout parameters enforces the width of each child to be?MATCH_PARENT?and the height of each child to be?WRAP_CONTENT, but only if the height is not specified. TableLayout示例 APIDemos:TableLayout1~12 TableLayout Tip TableLayout不能嵌套在LinearLayout,RelativeLayout内,也不能包含其它布局 通常情况下,不建议使用TableLayout,建议使用GridView AbsoluteLayout A layout that lets you specify exact locations (x/y coordinates) of its children. Absolute layouts are less flexible and harder to maintain than other types of layouts without absolute positioning. AbsoluteLayout布局参数 重用XML布局文件 可以在一个布局文件中,引用另外一个布局文件,方式是使用include标签,在该标签内必须包括layout属性。 重用XML布局文件示例 《Android开发权威指南》 P82 优化XML布局文件 merge标签的使用 《Android开发权威指南》 P85 长沙学院计算机系 周景 * * 长沙学院计算机系 周景 长沙学院计算机系 周景 长沙学院计算机系 周景 长沙学院计算机系 周景 长沙学院计算机系 周景 长沙学院计算机系 周景 长沙学院计算机系 周景 Android开发技术 长沙学院计算机系 周景 * 第3章 Android用户界面开发 重点: Android用户界面布局的介绍 界面布局的参数(LayoutParams) FrameLayout LinearLayout RelativeLayout 视图层次 an Activitys UI using a hierarchy of View and ViewGroup nodes, as shown in the diagram below. View This class represents the basic building block for user interface components. A View occupies a rectangular area on the screen and is responsible for drawing and event handling. View is the base class f
文档评论(0)