Android移动应用开发教程 课件 3.1、布局管理器_第1页
Android移动应用开发教程 课件 3.1、布局管理器_第2页
Android移动应用开发教程 课件 3.1、布局管理器_第3页
Android移动应用开发教程 课件 3.1、布局管理器_第4页
Android移动应用开发教程 课件 3.1、布局管理器_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

布局管理器Android汇报人:XXX目录2345帧布局表格布局约束布局案例实现1线性布局01章节PART线性布局添加相关标题文字添加相关标题文字添加相关标题文字添加相关标题文字单行或单列排列orientation属性可以设定界面元素呈现垂直(vertical)或水平(horizontal)排列组件超过边界,不可见展示<LinearLayoutxmlns:android="/apk/res/android"android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent"android:gravity="center"></LinearLayout>线性布局属性说明android:orientation设定布局管理器内部组件的排列方式,可选值:horizontal(水平)、vertical(垂直),默认verticalandroid:gravity设置布局管理器内组件的对齐方式,可选值:top、botton、left、right、center_vertical、fill_vertical、center_horizontal、fill_horizontal、center、fill、clip_vertical、clip_horizontalandroid:layout_width设置组件的基本宽度,可选值:fill_parent(与父容器宽度相同)、math_parent(同fill_parent)、wrap_content(由内容决定)android:layout_height设置组件的基本高度,可选值:fill_parent(与父容器高度相同)、math_parent(同fill_parent)、wrap_content(由内容决定)android:id唯一识别码,在Java代码中可以引用android:background设置背景,可以是图片也可以是颜色02章节PART帧布局添加相关标题文字添加相关标题文字添加相关标题文字添加相关标题文字重叠展示所有的子元素都不能指定位置属性并且后面的子元素直接覆盖在前面的子元素之上<FrameLayoutxmlns:android="/apk/res/android"xmlns:tools="/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity"> <TextViewandroid:id="@+id/textView_01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="80sp" android:textColor="#336699" android:text="A"/> <TextViewandroid:id="@+id/textView_02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="120sp" android:textColor="#6699CC" android:text="B"/> <TextViewandroid:id="@+id/text_03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="160sp" android:textColor="#99CCFF" android:text="C"/></FrameLayout>帧布局属性描述android:forground设置布局容器的前景图像android:foregroundGravity定义绘制前景图像的gravity属性,即前景图像显示的位置android:layout_gravity布局内组件的对齐方式03章节PART表格布局添加相关标题文字添加相关标题文字添加相关标题文字添加相关标题文字表格展示表格布局(TableLayout)适用于N行N列的布局格式一个TableRow就代表TableLayout中的一行TableRow可以添加其他组件,每添加一个组件,表格就会增加一列TableRow子元素都是横向排列,并且宽高一致的表格布局XML属性描述android:collapseColumns设置需要被隐藏的列的列序号(从0开始),多个列序号之间用逗号隔开android:shrinkColumns设置允许被收缩的列的列序号(从0开始),多个列序号之间用逗号隔开android:stretchColumns设置允许被拉伸的列的列序号(从0开始),多个列序号之间用逗号隔开表格布局<TableLayoutxmlns:android="/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="vertical"><TableRow><EditText

android:id="@+id/edit"

android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="请输入内容"/><Button

android:id="@+id/btn"

android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="搜索"/></TableRow><Viewandroid:id="@+id/hr"android:layout_height="2dp"android:background="#FDF5E6"/><TableRow><TextView

android:id="@+id/label"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="请选择您的性别"/><RadioGroupandroid:id="@+id/gender"android:layout_width="wrap_content"android:layout_height="wrap_content"android:checkedButton="@+id/male"android:orientation="vertical"><RadioButtonandroid:id="@+id/male"android:text="男"/><RadioButton

android:id="@+id/female"android:text="女"/></RadioGroup></TableRow></TableLayout>04章节PART约束布局添加相关标题文字添加相关标题文字添加相关标题文字添加相关标题文字

在ConstraintLayout中,组件之间、组件与父布局之间具有约束关系,组件的位置是按照约束来计算的,使用ConstraintLayout布局时,也可以添加引导线(Guideline)来辅助布局约束布局组件前、后、上、下、左、右关系约束布局属性功能app:layout_constraintLeft_toLeftOf组件的左边框与某个组件的左边框对齐或者在其右边app:layout_constraintLeft_toRightOf组件的左边框与某个组件的右边框对齐或者在其右边app:layout_constraintRight_toLeftOf组件的右边框与某个组件的左边框对齐或在其左边app:layout_constraintRight_toRightOf组件的右边框与某个组件的右边框对齐或在其左边app:layout_constraintTop_toTopOf组件的顶部边框与某个组件的顶部边框水平对齐或在其下边app:layout_constraintTop_toBottomOf组件的顶部边框与某个组件的底部边框水平对齐或在其下边app:layout_constraintBottom_toTopOf组件的底部边框与某个组件的顶部边框水平对齐或其上边app:layout_constraintBottom_toBottomOf组件的底部边框与某个组件的底部边框水平对齐或其上边app:layout_constraintBaseline_toBaselineOf组件与某个组件水平对齐app:layout_editor_absoluteX组件在布局中X轴的绝对坐标点app:layout_editor_absoluteY组件在布局中Y轴的绝对坐标点app:layout_constraintGuide_begin布局中引导线距顶部或左边框的距离app:layout_constraintGuide_end布局中引导线距底部的距离app:layout_constraintGuide_percent在整个布局中引导线距离左边框的百分百app:layout_constraintStart_toEndOf组件的左边界在某个组件右边界的右边,及表示此组件在某个组件的右边app:layout_constraintStart_toStartOf组件的左边界与某个组件的左边界在同一垂直线上app:layout_constraintEnd_toStartOf组件的右边界与某个组件的左边界在同一垂直线上app:layout_constraintEnd_toEndOf组件的右边界与某个组件的右边界对齐app:layout_constraintHorizontal_bias组件在布局中的水平方向上的偏移百分百app:layout_constraintVertical_bias组件在布局中的的垂直方向上的偏移百分百app:layout_constraintDimensionRatio两个组件的纵横比,使用前需要把宽(layout_width)或者高(layout_height)设置为0dp,根据另一个属性和比例来计算当前属性app:layout_constraintCircle设置与某个组件进行角度定位app:layout_constraintCircleAngle定位角度app:layout_constraintCircleRadius角度定位半径约束布局属性功能android:layout_marginBottom离某元素底边缘的距离android:layout_marginLeft离某元素左边缘的距离android:layout_marginRight离某元素右边缘的距离android:layout_marginTop离某元素上边缘的距离android:layout_marginStart离开始的位置的距离android:layout_marginEnd离结束位置的距离属性功能app:layout_goneMarginLeft离某元素底边缘的距离app:layout_goneMarginTop离某元素左边缘的距离app:layout_goneMarginRight离某元素右边缘的距离app:layout_goneMarginBottom离某元素上边缘的距离app:layout_goneMarginStart离开始的位置的距离app:layout_goneMarginEnd离结束位置的距离约束布局约束在一起,形成一条链链头中设置

layout_constraintHorizontal_chainStyle属性来改变整条链的样式05章节PART案

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论