资源预览内容
第1页 / 共14页
第2页 / 共14页
第3页 / 共14页
第4页 / 共14页
第5页 / 共14页
第6页 / 共14页
第7页 / 共14页
第8页 / 共14页
第9页 / 共14页
第10页 / 共14页
亲,该文档总共14页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
middleware technology and application移动平台应用软件开发界面布局宁夏大学数学计算机学院 二零一五年middleware technology and application提纲布局LinearLayoutRelativeLayoutFrameLayoutTableLayoutAbsoluteLayoutmiddleware technology and application布局布局是一种可用于放置很多控件的容器。多层布局的嵌套:布局的内部除了可以放 置控件外,还可以放置布局。middleware technology and applicationLinearLayoutLinearLayout(线性布局)是一种常用的布局。它所包含的控件在线性方向上依次排列。通过android:orientation属性指定排列方向vertical(垂直方向)horizontal(水平方向,缺省)middleware technology and applicationandroid:layout_gravity指定控件在布局中的对齐 方式。gravity VS. layout_gravity值包含:top、bottom、center_vertical等。该属性的效果取决于布局方式,如线性布局排列方向为horizontal(水平)因此,只有垂直方向的值是有效的middleware technology and applicationandroid:layout_weight通过比例的方式来指定控件的大小。在界面适配时,作用很大。middleware technology and application屏幕适配的例子大家考虑一下,这样 有什么好处?middleware technology and applicationRelativeLayout相对布局通过相对位置的方式使控件出现在布局 的任意位置。可通过相对于父布局定位,也可以通过相对于控 件进行定位。属性比较多,但是非常简单,很容易掌握middleware technology and applicationmiddleware technology and applicationmiddleware technology and applicationFrameLayout所有的元素都被放置在FrameLayout区域的 最左上的区域,而且无法为这 些元素指定一 个确切的位置。如果一个FrameLayout里面有多个元素,那 么后面的子元素的显示会重叠在前一个元素 上。middleware technology and applicationTableLayout把每个控件以行和列的形式进行排列每行为一个TableRow对象在TableRow中还可以继续添加其他的控件,每添加 一个子控件就成为一列。middleware technology and applicationAbsoluteLayout绝对布局又叫坐标布局,可以直接指定子元素的 绝对位置layout_x、layout_y 这种布局简单直接,但由于手机屏幕尺寸差别比 较大,使用绝对定位的适应性较差。 在绝对定位中,如果子元素不设置layout_x和 layout_y,那么它们的默认值是0。middleware technology and applicationQ&A本讲结束 !
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号