1.LinearLayout //线性布局
android:orientation="" //设置控件的排列方式 horizontal 垂直 vertical 水平
<EditText
android:id="@+id/edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" //在页面按比例布局
android:hint="type something"
/>
<Button
android:id="@+id/button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="send"
/>
显示:
___【】
若改成
<EditText
android:id="@+id/edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="type something"
/> //edit_text会占满剩余屏幕
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="send"
/>
显示:
__________【】
2.RelativeLayout //相对布局
在页面布局:
android:layout_alignParentLeft+android:layout_alignParenTop:左上
android:layout_alignParenRight+android:layout_alignParenBottom:右下
android:layout_centerInParent:居中
相对控件布局:
//在button3右上
android:layout_above="@id/button3"
android:layout_toRightOf="@id/button3"
//在button3左下
android:layout_below="@id/button3"
android:layout_toLeftOf="@id/button3"
//与button3左边缘对齐
android:layout_alignLeft="@id/button3"
//与button3上端对齐
android:layout_alignTop="@id/button3"
3.TableLayout //表格布局
<TableLayout
。。。
android:stretchColumns="1" //延伸第二格以填充空白 0表示第一格
>
android:stretchColumns="1" //延伸第二格以填充空白 0表示第一格
>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:text="Account:"
/>
<EditText
android:id="@+id/account"
android:layout_height="wrap_content"
android:hint="Input your account"
/>
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:text="Password:"
/>
<EditText
android:id="@+id/password"
android:layout_height="wrap_content"
android:inputType="textPassword"
/>
</TableRow>
<TableRow>
<Button
android:id="@+id/login"
android:layout_height="wrap_content"
android:layout_span="2" //合并单元格
android:text="login"
/>
</TableRow>
显示:
Account: ______________
Password:______________
【 login 】
2.各控件所占比例可通过 如weightSum="1"(总比例) 和 android:layout_weight="(内填比例)"
控制
相关推荐
ExtJs常用布局--layout详解实例代码: ExtJs常见的布局方式有:border、form、absolute、column、accordion、table、fit、card、anchor 另外,不常见的布局有:tab、vbox、hbox 具体使用方法可见该文件的案例代码。 ...
主要是针对android初学者对于android的layout布局不是很清楚的人
Android中常用的5大布局方式有以下几种: 线性布局(LinearLayout):按照垂直或者水平方向布局的组件。 帧布局(FrameLayout):组件从屏幕左上方布局组件。 表格布局(TableLayout):按照行列方式布局组件。 ...
iOS 详解 Auto Layout 是怎么进行自动布局的,性能如何?
折叠布局Ext.layout.AnchorLayout 边框布局Ext.layout.BorderLayout 卡片式布局Ext.layout.CardLayout 列布局Ext.layout.ColumnLayout 填充布局xt.layout.FitLayout 表单布局Ext.layout.FormLayout 表格布局Ext....
1. 怎样建立自己的元件库? 建立了一个新的project后,画原理图的第一步就是先建立自己所需要的库,所采用的工具就是part developer. 首先在建立一个存放元件库的目录(如mylib),然后用写字板打开cds.lib,定义:...
一个JavaFx应用可以通过设置每...本话题为JavaFx layout包中提供的的每个布局窗格都给出了相应的概述和简单的示例。LayoutSample.java文件包含了本话题中UI的源码。LayoutSample.zip文件包含了示例应用的NetBeans工程。
port目录,相应的layout文件名不变,比如:layout-land是横屏的layout,layout-port是竖屏的layout,其他的不用管,横竖屏切换时程序调用Activity的onCreate方法中的setOnContent(xxx),并自动加载相应的布局。...
主要介绍了使用jquery-easyui的布局layout写后台管理页面的代码详解,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
***本文关键词:table-layout属性值、定义和用法、固定表格布局、自动表格布局。 1定义和用法 tableLayout属性用来显示表格单元格、行、列的算法规则。 ①该属性指定了完成表布局时所用的布局算法。 ②固定...
View的布局显示方式有下面几种:线性布局(Linear Layout)、相对布局(Relative Layout)、表格布局(Table Layout)、网格视图(Grid View)、标签布局(Tab Layout)、列表视图(List View)、绝对布局...
Android布局详解 RelativeLayout用到的一些重要的属性: 第一类:属性值为true或false android:layout_centerHrizontal 水平居中 android:layout_centerVertical 垂直居中 android:layout_...
主要为大家详细介绍了jQuery布局组件EasyUI Layout的使用方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
1.首先修改application配置文件resources.layout.layoutPath = APPLICATION_PATH “/layouts/scripts”指定布局文件的位置 2.然后最简单的方法就是修改引导文件 bootstrap.php文件添加一个自动执行的方法:protected...
主要介绍了Zend Framework教程之Zend_Layout布局助手用法,结合实例形式详细分析了Layout布局的相关实现技巧,需要的朋友可以参考下
Android约束布局ConstraintLayout使用完全解析 Android约束布局ConstraintLayout使用完全解析
本文为大家分享了Android动态布局的实现代码,供大家参考,具体内容如下 ...1、setContentView()之前new一个需要的布局layout,再将layout放入setContentView() 2、new 出需要的控件设置好参数(i
本文主要介绍Android Layout XML 一些属性,在Android开发过程中布局文件大家肯定都会用到,在这里对Layout XML 进行详解,希望能对大家有所帮助
我们先来了解一下布局文件的基本内容: 1. 根标签及id 设置Android自带id : XML布局文件中, 可以使用 标签设置, 其中的id 需要引用 android的自带id : android:id=@android:id/tabhost ; getHost()获取前提 : 设置...