首页
找靠谱产品
找解决方案
找靠谱公司
找案例
找对的人
专家智库
悬赏任务
SAAS
ToB门户
了解全球最新的ToB事件
论坛
潜水/灌水快乐,沉淀知识,认识更多同行。
ToB圈子
加入IT圈,遇到更多同好之人。
微博
Follow
记录
Doing
博客
Blog
文库
业界最专业的IT文库,上传资料也可以赚钱
下载
分享
Share
排行榜
Ranklist
相册
Album
应用中心
qidao123.com ToB IT社区-企服评测·应用市场
»
论坛
›
数据库
›
Oracle
›
安卓根本布局(下)
返回列表
发新帖
安卓根本布局(下)
[复制链接]
发表于 2026-2-14 02:37:39
|
显示全部楼层
|
阅读模式
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要
登录
才可以下载或查看,没有账号?
立即注册
×
TableLayout
常用属性形貌collapseColumns设置必要被潜伏的列的列号。shrinkColumns设置答应被伸缩的列的列号。stretchColumns设置答应被拉伸的列的列号。
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/TableLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:collapseColumns="0,2"
android:shrinkColumns="3"
android:stretchColumns="1">
<TableRow>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="one" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="two" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="three" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="four" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="five" />
</TableRow>
</TableLayout>
复制
代码
FrameLayout帧布局
这个布局直接在屏幕上开辟出一块空缺的地区,当我们往内里添加控件的时间,会默认把他们放到这块地区的左上角。帧布局的巨细由控件中最大的子控件决定,如果控件的巨细一样大的话,那么同一时间就只能看到最上面的谁人组件,后续添加的控件会覆盖前一个。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FrameLayoutActivity">
<TextView
android:layout_width="200dp"
android:layout_height="200dp"
android:background="#FF6143" />
<TextView
android:layout_width="150dp"
android:layout_height="150dp"
android:background="#7BFE00" />
<TextView
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#FFFF00" />
</FrameLayout>
复制
代码
GridLayout
与表格布局类似,但是比表格布局机动。
常用属性形貌orientation设置分列方式。vertical:竖直(默认);horizontal:程度。layout_gravity设置对齐方式。rowCount设置行数。columnCount设置列数。layout_row设置第几行。layout_column设置第几列。layout_rowSpan设置高出几行。layout_columnSpan设置高出列数。
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/GridLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnCount="5"
android:orientation="horizontal"
android:rowCount="5" >
<Button
android:layout_gravity="fill"
android:text="1"
android:layout_columnSpan="3"/>
<Button
android:layout_gravity="fill"
android:text="2"
android:layout_column="1"
android:layout_rowSpan="3"/>
<Button android:text="3" />
<Button
android:text="4"
android:layout_row="2"/>
<Button android:text="5" />
<Button android:text="6" />
<Button android:text="7" />
<Button android:text="8" />
<Button android:text="9" />
</GridLayout>
复制
代码
回复
使用道具
举报
返回列表
浏览过的版块
物联网
移动端开发
SQL-Server
DevOps与敏捷开发
开源技术
Java
分布式数据库
虚拟化与私有云
人工智能
不到断气不罢休
+ 我要发帖
登录后关闭弹窗
登录参与点评抽奖 加入IT实名职场社区
去登录
微信订阅号
微信服务号
微信客服(加群)
H5
小程序
快速回复
返回顶部
返回列表