- 浏览: 3572707 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (1491)
- Hibernate (28)
- spring (37)
- struts2 (19)
- jsp (12)
- servlet (2)
- mysql (24)
- tomcat (3)
- weblogic (1)
- ajax (36)
- jquery (47)
- html (43)
- JS (32)
- ibatis (0)
- DWR (3)
- EXTJS (43)
- Linux (15)
- Maven (3)
- python (8)
- 其他 (8)
- JAVASE (6)
- java javase string (0)
- JAVA 语法 (3)
- juddiv3 (15)
- Mule (1)
- jquery easyui (2)
- mule esb (1)
- java (644)
- log4j (4)
- weka (12)
- android (257)
- web services (4)
- PHP (1)
- 算法 (18)
- 数据结构 算法 (7)
- 数据挖掘 (4)
- 期刊 (6)
- 面试 (5)
- C++ (1)
- 论文 (10)
- 工作 (1)
- 数据结构 (6)
- JAVA配置 (1)
- JAVA垃圾回收 (2)
- SVM (13)
- web st (1)
- jvm (7)
- weka libsvm (1)
- weka屈伟 (1)
- job (2)
- 排序 算法 面试 (3)
- spss (2)
- 搜索引擎 (6)
- java 爬虫 (6)
- 分布式 (1)
- data ming (1)
- eclipse (6)
- 正则表达式 (1)
- 分词器 (2)
- 张孝祥 (1)
- solr (3)
- nutch (1)
- 爬虫 (4)
- lucene (3)
- 狗日的腾讯 (1)
- 我的收藏网址 (13)
- 网络 (1)
- java 数据结构 (22)
- ACM (7)
- jboss (0)
- 大纸 (10)
- maven2 (0)
- elipse (0)
- SVN使用 (2)
- office (1)
- .net (14)
- extjs4 (2)
- zhaopin (0)
- C (2)
- spring mvc (5)
- JPA (9)
- iphone (3)
- css (3)
- 前端框架 (2)
- jui (1)
- dwz (1)
- joomla (1)
- im (1)
- web (2)
- 1 (0)
- 移动UI (1)
- java (1)
- jsoup (1)
- 管理模板 (2)
- javajava (1)
- kali (7)
- 单片机 (1)
- 嵌入式 (1)
- mybatis (2)
- layui (7)
- asp (12)
- asp.net (1)
- sql (1)
- c# (4)
- andorid (1)
- 地价 (1)
- yihuo (1)
- oracle (1)
最新评论
-
endual:
https://blog.csdn.net/chenxbxh2 ...
IE6 bug -
ice86rain:
你好,ES跑起来了吗?我的在tomcat启动时卡在这里Hibe ...
ES架构技术介绍 -
TopLongMan:
...
java public ,protect,friendly,private的方法权限(转) -
贝塔ZQ:
java实现操作word中的表格内容,用插件实现的话,可以试试 ...
java 读取 doc poi读取word中的表格(转) -
ysj570440569:
Maven多模块spring + springMVC + JP ...
Spring+SpringMVC+JPA
android中tablelayout是挺好用的布局
我自己在学的过程中,特别是和listview合用。
有几个属性要注意下
android :layout_span ="4"
就是说把4个列合并在一起(??)
Android 使用 TableLayout 布局拉伸宽度
布局文件
<?xml version="1.0 " encoding="utf-8 "?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android " android:orientation="vertical " android:layout_width="fill_parent " android:layout_height="fill_parent "> <TableLayout android:layout_width="match_parent " android:layout_height="match_parent "> <TableRow> <EditText android:id="@+id/et_led " android:layout_width="fill_parent " android:digits="1234567890.+-*/=%\n\t() " android:text="" android:layout_span="4 " /> </TableRow> <TableRow> <Button android:text="( " android:id="@+id/btn_LeftParenthesis "></Button> <Button android:text=") " android:id="@+id/btn_RightParenthesis "></Button> <Button android:text="* " android:id="@+id/btn_x "></Button> <Button android:text="back " android:id="@+id/btn_back "></Button> </TableRow> <TableRow> <Button android:text="7 " android:id="@+id/btn_7 "></Button> <Button android:text="8 " android:id="@+id/btn_8 "></Button> <Button android:text="9 " android:id="@+id/btn_9 "></Button> <Button android:text="% " android:id="@+id/btn_mod "></Button> </TableRow> <TableRow> <Button android:text="4 " android:id="@+id/btn_4 "></Button> <Button android:text="5 " android:id="@+id/btn_5 "></Button> <Button android:text="6 " android:id="@+id/btn_6 "></Button> <Button android:text="/ " android:id="@+id/btn_div "></Button> </TableRow> <TableRow> <Button android:text="1 " android:id="@+id/btn_1 "></Button> <Button android:text="2 " android:id="@+id/btn_2 "></Button> <Button android:text="3 " android:id="@+id/btn_3 "></Button> <Button android:text="- " android:id="@+id/btn_sub "></Button> </TableRow> <TableRow> <Button android:text="0 " android:id="@+id/btn_0 "></Button> <Button android:text=". " android:id="@+id/btn_dot "></Button> <Button android:text="+ " android:id="@+id/btn_plus "></Button> <Button android:text="= " android:id="@+id/btn_equal "></Button> </TableRow> </TableLayout> </LinearLayout>
布局效果:
显然这不能满足我们的期望,下面我们演示 使用 android:stretchColumns 来自动拉伸
我们这里简单的给 TableLayout 增加一个属性 android:stretchColumns="*" 表示所有列都要自动拉伸,以便适应屏幕宽度。
布局效果
它的值即可以是数字,也可以是*,注意数字是从0开始的,即:android:stretchColumns="1" 是设置 TableLayout所有行的第二列为扩展列。
上面我们会看到 第四列的按钮比其他列的按钮要宽,如果我们想都一样宽如何办呢?
一个简单办法:
在自动拉伸的基础上,把每一列的宽度都设置成一样,比如下面的代码:
<? xml version="1.0" encoding="utf-8"?> < LinearLayout xmlns :android ="http://schemas.android.com/apk/res/android" android :orientation ="vertical" android :layout_width ="fill_parent" android :layout_height ="fill_parent" > < TableLayout android :layout_width ="match_parent" android :layout_height ="match_parent" android :stretchColumns ="*" > < TableRow > < EditText android :id ="@+id/et_led" android :layout_width ="fill_parent" android :digits ="1234567890.+-*/=%\n\t()" android :text ="" android :layout_span ="4" /> </ TableRow > < TableRow > < Button android :text ="(" android :id ="@+id/btn_LeftParenthesis" android :layout_width ="1dip" > </ Button > < Button android :text =")" android :id ="@+id/btn_RightParenthesis" android :layout_width ="1dip" > </ Button > < Button android :text ="*" android :id ="@+id/btn_x" android :layout_width ="1dip" > </ Button > < Button android :text ="back" android :id ="@+id/btn_back" android :layout_width ="1dip" > </ Button > </ TableRow > < TableRow > < Button android :text ="7" android :id ="@+id/btn_7" > </ Button > < Button android :text ="8" android :id ="@+id/btn_8" > </ Button > < Button android :text ="9" android :id ="@+id/btn_9" > </ Button > < Button android :text ="%" android :id ="@+id/btn_mod" > </ Button > </ TableRow > < TableRow > < Button android :text ="4" android :id ="@+id/btn_4" > </ Button > < Button android :text ="5" android :id ="@+id/btn_5" > </ Button > < Button android :text ="6" android :id ="@+id/btn_6" > </ Button > < Button android :text ="/" android :id ="@+id/btn_div" > </ Button > </ TableRow > < TableRow > < Button android :text ="1" android :id ="@+id/btn_1" > </ Button > < Button android :text ="2" android :id ="@+id/btn_2" > </ Button > < Button android :text ="3" android :id ="@+id/btn_3" > </ Button > < Button android :text ="-" android :id ="@+id/btn_sub" > </ Button > </ TableRow > < TableRow > < Button android :text ="0" android :id ="@+id/btn_0" > </ Button > < Button android :text ="." android :id ="@+id/btn_dot" > </ Button > < Button android :text ="+" android :id ="@+id/btn_plus" > </ Button > < Button android :text ="=" android :id ="@+id/btn_equal" > </ Button > </ TableRow > </ TableLayout > </ LinearLayout >
这时候的效果就成了:
注意比起最初的就多了2个设置
android :layout_width ="1dip" 和 android :stretchColumns ="*"
发表评论
-
android离线
2019-11-04 21:25 301https://www.jianshu.com/p/fdfc4 ... -
android 异步更新
2015-07-11 22:42 1504http://www.apkbus.com/forum.php ... -
仿微米
2015-06-26 10:22 0http://www.javaapk.com/source/4 ... -
仿微信
2015-06-26 10:21 1921http://www.javaapk.com/source/1 ... -
网易客户端
2015-06-26 10:20 1606http://www.javaapk.com/source/4 ... -
仿朋友圈
2015-06-26 10:18 1701http://www.javaapk.com/source/8 ... -
仿朋友圈
2015-06-26 10:13 1839http://www.eoeandroid.com/threa ... -
全国ABC查询
2015-06-26 10:07 1376IM 功能 环信云 信息统计 Umeng 分享Umeng 更新 ... -
android 判断网络
2015-06-25 16:00 1268http://www.cnblogs.com/renqingp ... -
android 多彩表格
2015-05-31 16:06 1479http://blog.csdn.net/conowen/ar ... -
android socket
2015-05-31 16:01 1649http://blog.csdn.net/conowen/ar ... -
微信播放语音3
2015-02-25 12:00 1436http://download.csdn.net/detail ... -
微信语音播放2
2015-02-25 11:57 1364http://download.csdn.net/detail ... -
微信语音播放
2015-02-25 11:56 1714http://www.apkbus.com/android-1 ... -
超强的资料整合
2015-01-05 11:04 1226http://zz563143188.iteye.com/bl ... -
最强开发资源平台大合集
2015-01-04 14:50 1887程序员代码应用开发平 ... -
Android-Universal-Image-Loader 图片异步加载类库的使用(超详细配置)
2014-09-04 15:45 1382http://blog.csdn.net/vipzjyno1/ ... -
android应用推广
2014-09-03 23:25 1317应用推广不必愁,有米 ... -
android 图片异步加载
2014-09-03 16:47 1135http://www.csdn.net/article/201 ... -
android hander的使用
2014-09-02 23:46 1364http://www.cnblogs.com/xiaoran1 ...
相关推荐
这篇文档主要探讨如何利用TableLayout布局来设计一个办公电话一览表。以下是对给定内容的详细解读: 1. **TableLayout基本介绍** TableLayout是LinearLayout的扩展,它允许你创建类似HTML表格的布局。它包含多个...
在Android开发中,TableLayout是布局管理器的一种,它允许开发者创建类似电子表格的布局,包含行和列来展示数据。这个"Android-TableLayout-Example"项目显然是一个示例,用于演示如何在Android应用中有效地使用...
总之,Android的TableLayout布局以其灵活的行和列管理,以及自适应的列宽和伸缩属性,为移动应用的界面设计提供了强大支持。理解并熟练掌握TableLayout的特性,可以帮助开发者构建出更加高效和用户友好的应用程序。
1. `android:stretchColumns`:指定哪些列应该拉伸以填满TableLayout的宽度。值是一个用逗号分隔的列索引列表。 2. `android:shrinkColumns`:指定哪些列可以缩小,以适应TableLayout的宽度。同样,值是一个列索引...
Android 布局之表格布局 TableLayout 详解 Android 中的表格布局 TableLayout 是一种常用的布局方式,它可以按照行列的形式管理子控件,每一行为一个 TableRow 对象。下面将对 TableLayout 的用法和属性进行详细的...
TableLayout是Android布局系统中的一个组件,用于组织和展示内容以表格的形式,它按照行列的方式来管理子视图。在Android应用开发中,TableLayout常用于创建具有结构化的数据展示或者复杂的用户界面,尤其是在需要对...
本文将深入探讨Android中的布局机制,尤其是`TableLayout`的使用和实现细节。 首先,Android提供了多种布局管理器,如LinearLayout、RelativeLayout、FrameLayout和GridLayout等,每种都有其特定的用途。`...
TableLayout是Android开发中一种布局管理器,它允许开发者以表格的形式组织UI元素。在Android应用设计中,TableLayout常用于展示数据或者创建有规则排列的界面,比如设置界面、菜单选项等。以下是对TableLayout的...
总结来说,Android的TableLayout布局提供了一种灵活的方式来构建二维的UI结构,通过调整不同的属性,可以实现各种复杂的表格布局效果。通过理解并熟练运用这些属性,开发者可以更好地满足用户界面的需求,创建出清晰...
在Android开发中,TableLayout是一种常用的布局方式,它允许开发者以表格的形式组织用户界面元素。TableLayout继承自LinearLayout,因此它的基本布局特性是线性的,但增加了表格的特性,使得内容可以按照行列的方式...
例如,如果你有一个三列的表格,第一列固定宽度,第三列内容自适应宽度,那么设置`android:stretchColumns="1"`将让第二列根据需要扩展,以填满整个TableLayout的宽度。可以设置多个列号,用逗号分隔,如`android:...
需要注意的是,尽管 TableLayout 在早期版本的 Android 应用中较为常用,但对于复杂的数据展示,建议考虑使用更现代的布局方案,如 RecyclerView 配合 GridLayoutManager 或 GridLayoutManager 来实现类似的效果,以...
TableLayout是Android开发中一种布局管理器,它用于在屏幕上以表格形式排列视图组件。在Android应用设计中,TableLayout常被用来构建有结构的数据展示或者创建复杂的用户界面。以下是对TableLayout的详细说明: 1. ...
《TableLayout_Project——深入解析Android TableLayout布局》 在Android开发中,TableLayout是一个非常实用的布局工具,它允许开发者创建表格样式的用户界面。这个名为"TableLayout_Project"的项目,显然着重于...
在Android开发中,TableLayout是布局管理器的一种,它允许开发者创建类似电子表格的布局,非常适合展示数据或者组织内容。本篇文章将详细讲解如何利用TableLayout在Android中实现表格效果。 **1. TableLayout基本...
在Android开发中,TableLayout是布局管理器的一种,它允许开发者以表格的形式组织UI组件。这种布局方式对于创建类似表格的用户界面非常有用,比如展示数据列表或者进行设置选项的排列。下面我们将详细探讨...
1. **设置TableLayout**:在XML布局文件中,首先声明`<TableLayout>`,并可以设置其属性,如`android:stretchColumns`,这将指定哪些列应该被拉伸以填充可用空间。 ```xml <TableLayout android:id="@+id/table_...
`android:stretchColumns`属性可以拉伸指定列以填满表格宽度,而`android:shrinkColumns`则允许列收缩以适应内容。 这六大布局各有特点,开发者应根据实际需求选择合适的布局。在现代Android开发中,常常混合使用...