当前位置: 首页 > news >正文

网站建设教程平台南昌网站专业制作

网站建设教程平台,南昌网站专业制作,网站建设 南昌招标,把微信小程序做网站Android的界面是有布局和组件协同完成的#xff0c;布局好比是建筑里的框架#xff0c;而组件则相当于建筑里的砖瓦。组件按照布局的要求依次排列#xff0c;就组成了用户所看见的界面。 所有的布局方式都可以归类为ViewGroup的5个类别#xff0c;即ViewGroup的5个直接子类…  Android的界面是有布局和组件协同完成的布局好比是建筑里的框架而组件则相当于建筑里的砖瓦。组件按照布局的要求依次排列就组成了用户所看见的界面。              所有的布局方式都可以归类为ViewGroup的5个类别即ViewGroup的5个直接子类。其它的一些布局都扩展自这5个类。 1.LinearLayout线性布局方式   这种布局比较常用也比较简单就是每个元素占一行当然也可能声明为横向排放也就是每个元素占一列。   LinearLayout按照垂直或者水平的顺序依次排列子元素每一个子元素都位于前一个元素之后。如果是垂直排列那么将是一个N行单列的结构每一行只会有一个元素而不论这个元素的宽度为多少如果是水平排列那么将是一个单行N列的结构。如果搭建两行两列的结构通常的方式是先垂直排列两个元素每一个元素里再包含一个LinearLayout进行水平排列。   LinearLayout中的子元素属性android:layout_weight生效它用于描述该子元素在剩余空间中占有的大小比例。加入一行只有一个文本框那么它的默认值就为0如果一行中有两个等长的文本框那么他们的android:layout_weight值可以是同为1。如果一行中有两个不等长的文本框那么他们的android:layout_weight值分别为1和2那么第一个文本框将占据剩余空间的三分之二第二个文本框将占据剩余空间中的三分之一。android:layout_weight遵循数值越小重要度越高的原则。 ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/android android:orientationvertical android:layout_widthfill_parent android:layout_heightfill_parent TextView android:layout_widthfill_parent android:layout_heightwrap_content android:background#ff000000 android:textstring/hello/ LinearLayout android:orientationhorizontal android:layout_widthfill_parent android:layout_heightfill_parent TextView android:layout_widthfill_parent android:layout_heightwrap_content android:background#ff654321 android:layout_weight1 android:text1/ TextView android:layout_widthfill_parent android:layout_heightwrap_content android:background#fffedcba android:layout_weight2 android:text2/ /LinearLayout /LinearLayout 2.Relative Layout相对布局   RelativeLayout按照各子元素之间的位置关系完成布局。在此布局中的子元素里与位置相关的属性将生效。例如androidlayout_below,  android:layout_above, android:layout_centerVertical等。注意在指定位置关系时引用的ID必须在引用之前先被定义否则将出现异常。   RelativeLayout是Android五大布局结构中最灵活的一种布局结构比较适合一些复杂界面的布局。 ?xml version1.0 encodingutf-8?RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/android android:orientationvertical android:layout_widthfill_parent android:layout_heightfill_parentTextView android:idid/text_01 android:layout_width50dp android:layout_height50dp android:background#ffffffff android:gravitycenter android:layout_alignParentBottomtrue android:text1/TextView android:idid/text_02 android:layout_width50dp android:layout_height50dp android:background#ff654321 android:gravitycenter android:layout_aboveid/text_01 android:layout_centerHorizontaltrue android:text2/TextView android:idid/text_03 android:layout_width50dp android:layout_height50dp android:background#fffedcba android:gravitycenter android:layout_toLeftOfid/text_02 android:layout_aboveid/text_01 android:text3//RelativeLayout 3.AbsoluteLayout绝对位置布局   在此布局中的子元素的android:layout_x和android:layout_y属性将生效用于描述该子元素的坐标位置。屏幕左上角为坐标原点0,0第一个0代表横坐标向右移动此值增大第二个0代表纵坐标向下移动此值增大。在此布局中的子元素可以相互重叠。在实际开发中通常不采用此布局格式因为它的界面代码过于刚性以至于有可能不能很好的适配各种终端。 ?xml version1.0 encodingutf-8?AbsoluteLayout xmlns:androidhttp://schemas.android.com/apk/res/android android:orientationvertical android:layout_widthfill_parent android:layout_heightfill_parentTextView android:layout_width50dp android:layout_height50dp android:background#ffffffff android:gravitycenter android:layout_x50dp android:layout_y50dp android:text1/TextView android:layout_width50dp android:layout_height50dp android:background#ff654321 android:gravitycenter android:layout_x25dp android:layout_y25dp android:text2/TextView android:layout_width50dp android:layout_height50dp android:background#fffedcba android:gravitycenter android:layout_x125dp android:layout_y125dp android:text3//AbsoluteLayout 4.FrameLayout帧布局  FrameLayout是五大布局中最简单的一个布局可以说成是层布局方式。在这个布局中整个界面被当成一块空白备用区域所有的子元素都不能被指定放置的位置它们统统放于这块区域的左上角并且后面的子元素直接覆盖在前面的子元素之上将前面的子元素部分和全部遮挡。如下第一个TextView被第二个TextView完全遮挡第三个TextView遮挡了第二个TextView的部分位置。 ?xml version1.0 encodingutf-8?FrameLayout xmlns:androidhttp://schemas.android.com/apk/res/android android:orientationvertical android:layout_widthfill_parent android:layout_heightfill_parentTextView android:layout_widthfill_parent android:layout_heightfill_parent android:background#ff000000 android:gravitycenter android:text1/TextView android:layout_widthfill_parent android:layout_heightfill_parent android:background#ff654321 android:gravitycenter android:text2/TextView android:layout_width50dp android:layout_height50dp android:background#fffedcba android:gravitycenter android:text3//FrameLayout 5.TableLayout表格布局   适用于N行N列的布局格式。一个TableLayout由许多TableRow组成一个TableRow就代表TableLayout中的一行。   TableRow是LinearLayout的子类ablelLayout并不需要明确地声明包含多少行、多少列而是通过TableRow以及其他组件来控制表格的行数和列数 TableRow也是容器因此可以向TableRow里面添加其他组件没添加一个组件该表格就增加一列。如果想TableLayout里面添加组件那么该组件就直接占用一行。在表格布局中列的宽度由该列中最宽的单元格决定整个表格布局的宽度取决于父容器的宽度默认是占满父容器本身。   TableLayout继承了LinearLayout因此他完全可以支持LinearLayout所支持的全部XML属性除此之外TableLayout还支持以下属性        XML属性                                       相关用法                                                    说明   1. andriodcollapseColumns           setColumnsCollapsedint boolean       设置需要隐藏的列的序列号多个用逗号隔开   2.androidshrinkColumns              setShrinkAllColumnsboolean                 设置被收缩的列的序列号多个用逗号隔开   3.androidstretchColimns             setSretchAllColumndsboolean               设置允许被拉伸的列的序列号多个用逗号隔开 ?xml version1.0 encodingutf-8?TableLayout xmlns:androidhttp://schemas.android.com/apk/res/android android:orientationvertical android:layout_widthfill_parent android:layout_heightfill_parentTableRow android:layout_widthfill_parent android:layout_heightwrap_contentTextView android:background#ffffffff android:gravitycenter android:padding10dp android:text1/TextView android:background#ff654321 android:gravitycenter android:padding10dp android:text2/TextView android:background#fffedcba android:gravitycenter android:padding10dp android:text3//TableRowTableRow android:layout_widthfill_parent android:layout_heightwrap_contentTextView android:background#ff654321 android:gravitycenter android:padding10dp android:text2/TextView android:background#fffedcba android:gravitycenter android:padding10dp android:text3/ /TableRowTableRow android:layout_widthfill_parent android:layout_heightwrap_contentTextView android:background#fffedcba android:gravitycenter android:padding10dp android:text3/TextView android:background#ff654321 android:gravitycenter android:padding10dp android:text2/TextView android:background#ffffffff android:gravitycenter android:padding10dp android:text1/ /TableRow/TableLayout 6.其他布局(隶属关系请看上图) 1列表视图List View   List View是可滚动的列表。以列表的形式展示具体内容并且能够根据数据的长度自适应显示。       具体应用请看用法一  http://www.cnblogs.com/allin/archive/2010/05/11/1732200.html          用法二  http://blog.csdn.net/koupoo/article/details/7018727  2网格视图Grid View   Grid View一个ViewGroup以网格显示它的子视图view元素即二维的、滚动的网格。   具体应用查看http://www.cnblogs.com/linzheng/archive/2011/01/19/1938760.html 3标签布局Tab Layout   以标签的方式显示它的子视图元素就像在Firefox中的一个窗口中显示多个网页一样。为了狂创建一个标签UItabbed UI需要使用到TabHost和TabWidget。TabHost必须是布局的根节点它包含为了显示标签的TabWidget和显示标签内容的FrameLayout。   具体应用查看http://www.cnblogs.com/devinzhang/archive/2012/01/18/2325887.html  -------------------------------------------------------------------- PS 欢迎关注公众号Devin说会不定期更新Java相关技术知识。 --------------------------------------------------------------------
http://www.zqtcl.cn/news/519357/

相关文章:

  • 重庆网站建设公司魁网个人备案网站名
  • 怀柔营销型网站建设wordpress菜单定制
  • 大连装修网站推广天津市建设信息工程网
  • 服装网站建设建议域名注册最好的网站
  • 小游戏网站网络营销推广岗位
  • 做一百度网站保健品网站建设案例
  • 沙田镇仿做网站如何建设钓鱼网站
  • 如何用域名进网站企业做电商网站有哪些
  • soho做网站网站的k线图怎么做
  • 成都专业的网站建设公司做网站需要哪个专业
  • php彩票网站建设源码有人看片吗免费观看
  • 自己做网站的准备工作营销平台推广
  • 建站网站平台建站工具的优点
  • 各学院二级网站建设通报wordpress 修改admin
  • 网站建设加推广需要多少钱wordpress标签自动生成插件下载
  • 周村区建设局网站石家庄网站运营公司
  • 网站描述怎么设置wordpress仿模板
  • 宁波市网站建设公司h5游戏是什么意思
  • 青岛网站设计案例全栈网站开发
  • 欢迎访问中国建设银行网站个人客户网站建设需要经历什么步骤
  • 建设银行怀柔支行营业部网站企业官网手机版
  • cms那个做网站最好大连网站开发平台
  • 佛山建设外贸网站公司可信网站图标
  • 沈阳.....网站设计连云港优化网站团队
  • 网站添加白名单想学ui设计从哪里入手
  • 做期货与做网站的关系淮安市城市建设档案馆网站
  • 网站建设的技术亮点单位宣传册设计样本
  • 网站建设与维护服务敦化市建设局网站
  • 官方网站建设思路wordpress改成织梦
  • 网站建设推广方法网站调优