导航:首页 > 操作系统 > 安卓表格布局的列怎么确定

安卓表格布局的列怎么确定

发布时间:2023-03-24 01:17:52

android 常见布局

Android六大基本布局分别是:线性布局LinearLayout、表格布局TableLayout、相对布局RelativeLayout、层布局FrameLayout、绝对布局AbsoluteLayout、网格布局GridLayout。其中,表格布局是线性布局的子类。网格布局是android 4.0后新增的布局。
在手机程序设计中,绝对布局基本上不用,用得相对较多的是线性布局和相对布局。

padding是站在父view的角度描述问题,它规定它里面的内容必须与这个父view边界的距离。margin则是站在自己的角度描述问题,规定自己和其他(上下左右)的view之间的距离,如果同一级只有一个view,那么它的效果基本上就和padding一样了。

显示特点:所有子控件按照横向或者竖向依次排列

left(左)、right(右)、top(上)、bottom(下)、center(中心)、
enter_vertical(竖向中心)、center_horizontal(横向中心)

left(左)、right(右)、top(上)、bottom(下)、center(中心)、
enter_vertical(竖向中心)、center_horizontal(横向中心)

子控件的用法:android:layout_weight="1" 多个控件同时使用,可以实现平分的效果

显示特点:和LinearLayout布局相似,所有子控件默认显示在RelativeLayout的左上角

layout_toRightOf 在指定控件的右边
layout_toLeftOf 在指定控件的左边
layout_above 在指定控件的上边
layout_below 在指定控件的下边子控件对齐关系

layout_alignRight 与指定控件右对齐
layout_alignLeft 与指定控件左对齐
layout_alignTop 与指定控件上对齐

layout_centerInParent 与父容器中间对齐 pairunte
layout_centerVertical 与父容器竖向中心对齐
layout_centerHorizontal 与父容器横向中心对齐
layout_alignParentLeft 与父容器左边对齐
layout_alignParentTop 与父容器上边对齐
layout_alignParentRight 与父容器右边对齐
layout_alignParentBottom 与父容器下边对齐

显示特点:所有子控件默认在GridLayout中横向依次排列,当只等每行的列数时,到达指定列数
会自动换行显示。

layout_column 在网格的第几列
layout_row 在网格的第几行
layout_columnSpan 跨列
layout_rowSpan 跨行
layout_gravity 在一个网格中的重心位置
columnCount 每行列总数

显示特点:所有的子控件默认显示在FrameLayout的左上角,会重叠在一起显示。

layout_gravity(设置给子控件,调整控件在容器内的重心)
常用值:
left(左)、 right(右)、
top(上)、 bottom(下)、
center(中心)、 center_vertical(竖向中心)
center_horizontal(横向中心)

表格布局和网格布局类似,但是需要注意的是,表格布局不能跨行,只能跨列

Ⅱ 在安卓中什么是线性布局,表格布局,相对布局求详细答案,急急急!!!!

线性布局(LinearLayout):在该标签下的所有子元素会根据orientation属性的值来决定是按行或者是按列来逐个显示。代码示例如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name" />

<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test" />

</LinearLayout>
而相对布局,则是根据控件的相对位置而言,比如居于按钮的左侧或者右侧,示例如下:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/button1"
android:layout_alignTop="@id/button1"
android:text="@string/hello_world" />

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="@string/app_name" />

</RelativeLayout>
分享

Ⅲ android ui开发中,tablelayout的列数是怎么计算的

TableLayout,表格布局采用行列形式管理UI组件,TableLayout不需要明确地声明有多少行和列,而是通过添加TableRow、其它组件来控制表格的行数、列数。
每次向TableLayout添加一个TableRow,就是在向表格添加一行,TableRow也是容器,可以向TableRow中添加组件,每添加一个组件,即是添加一列。
如果直接向TableLayout添加组件,则认为这个组件占用一行。
表格布局中列的宽度即是每一列中最宽的组件的宽度。
使用前:

\

使用后:

\

<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:text="最近联备碰系人"
android:id="@+id/button4"
android:layout_width="1dip"
android:layout_height="wrap_content"></Button>

<Button
android:text="联系人"
android:id="@+id/button5"
android:layout_width="1dip"
android:layout_height="wrap_content"></Button>

<Button
android:text="分组"
android:id="@+id/button5"
android:layout_width="1dip"
android:layout_height="wrap_content"></Button>

</TableRow>

</TableLayout>
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:text="最近联系人"
android:id="@+id/button4"
android:layout_width="1dip"
android:layout_height="wrap_content"></Button>

<Button
android:text="联系人"
android:id="@+id/button5"
android:layout_width="1dip"
android:layout_height="wrap_content"></Button>

<Button
android:text="分组"
android:id="@+id/button5"
android:layout_width="1dip"
android:layout_height="wrap_content"></Button>

</TableRow>

</TableLayout>
TableLayout 增加一个属性 android:stretchColumns="*"伍辩 表示所有列都要自动拉伸,以便适应屏幕宽度。

它的值即可以是数字,也可以是*,注意数字是从仿橘谈0开始的,即:android:stretchColumns="1" 是设置 TableLayout所有行的第二列为扩展列。

上面我们会看到 第1列的按钮比其他列的按钮要宽,如果我们想都一样宽如何办呢?

一个简单办法:

android:layout_width="1dip"

Ⅳ android 表格布局怎么显示出表格线,怎么样设置跨几行跨几列

intent可以传值的,intent.putextra();把你的评论参数放进去,在接收页面直接调用getintent获得这个intent,然后把值取出来就可以了

Ⅳ android实现方格布局

应该使用表格布局。
表格布局即,tableLayout,表格布局通过行、列的形式来管理UI组件,TablelLayout并不需要明确地声明包含多少行、多少列,而是通过TableRow,以及其他组件来控制表格的行数和列数, TableRow也是容器,因此可以向TableRow里面添加其他组件,没添加一个组件该表
格就增加一列。
如果想
TableLayout里面添加组件,那么该组件就直接占用一行。
在表格布局中,列的宽度由该列中最宽的单元格决定,整个表格布局的宽度取决于父容
器的宽度(默认是占满父容器本身)。
TableLayout继承了LinearLayout,因此他完全可以支持LinearLayout所支持的全部XML属性,除此之外TableLayout还支持以下属性:
XML属性相关用法说明
1. andriod:collapseColumns setColumnsCollapsed(int ,boolean) 设置需要隐藏的列的序列号,多个用逗号隔开
2.android:shrinkColumns setShrinkAllColumns(boolean)设置被收缩的列的序列号,多个用逗号隔开
3.android:stretchColimns setSretchAllColumnds(boolean)设置允许被拉伸的列的序列号,多个用逗号隔开

Ⅵ android 表格布局怎样设置某列比例

你好,看了你的布局,大概分成3部分

,第一部分是标题,第二部分是薯掘左边的部分,

第三部分是右侧部分,那么问题就颂手敬分3个布局解决就好: ----------------这部分写左侧的内容-------------------- ---------------- 这野慎部分写右侧的内容--------------...

Ⅶ Android怎样获取TableLayout TableRow的第几行第几列

android-TableLayout以及TableRow的使用

TableLayout是一种可以制作表格的布局,它和GridLayout的区别是GridLayout只能制定每一列宽度一样的表格布局,而TableLayout能够制定各列宽度不一样的表格布局。

TableLayout的主要属性:

android:collapseColumns=”0,1” 隐藏第0列和第1列
android:stretchColumns=”0,1” 第0列和第1列可以向行方向扩展
android:stretchColumns=”*” 所有列可烂银拿以向行方向扩展
android:shrinkColumns=”0,1” 第0列和第1列可以饥搭向列方向扩展

TableRow的子控件的主要属性:

android:layout_column=”1”搏亩 该控件显示在第1列
android:layout_span=”2” 该控件占据2列

详细

阅读全文

与安卓表格布局的列怎么确定相关的资料

热点内容
美国所有恐怖露点电影 浏览:864
手机nfc刷全加密ic卡 浏览:775
51单片机24小时 浏览:880
数控左右r怎样编程 浏览:990
电影过时了能换票吗 浏览:349
php获取远程json 浏览:439
一个男的一个女的在河边被一箭射穿的恐怖电影 浏览:76
有部小说女主叫温暖 浏览:977
linux命令app 浏览:792
土方标高计算法 浏览:593
家教高级教程女演员叫什么 浏览:360
日本日本翻译汉语电影 浏览:491
言情动漫免费 浏览:40
安卓手机图像变黑白色了怎么办 浏览:279
linux查看用户和密码 浏览:976
穿书荒岛:女主把我奶上天小说 浏览:156
主角能看见别人气运的小说 浏览:577
求一个不用下载播放器的网址 浏览:686
免费在线国产小电影 浏览:544
尺度大的女同电影 浏览:371