android:shrinkColumns 和 android:stretchColumns 是如何工作的? [英] How do android:shrinkColumns and android:stretchColumns work?

查看:23
本文介绍了android:shrinkColumns 和 android:stretchColumns 是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在TableLayout 设置android:shrinkColumnsandroid:stretchColumns.

例如:

<TableLayout
    android:shrinkColumns="2,3"
    android:stretchColumns="1,3"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

那么这个属性是如何影响列的呢?

So how do this properties affects columns?

推荐答案

TableLayout 可以通过调用 setColumnShrinkable()(xml:android:shrinkColumns) 或 setColumnStretchable()(xml:android:stretchColumns).

TableLayout can specify certain columns as shrinkable or stretchable by calling setColumnShrinkable()(xml:android:shrinkColumns) or setColumnStretchable()(xml:android:stretchColumns).

如果标记为shrinkable,则可以缩小列宽以使表格适合其父对象.如果标记为可拉伸,它可以扩展宽度以适应任何额外空间.

If marked as shrinkable, the column width can be shrunk to fit the table into its parent object. If marked as stretchable, it can expand in width to fit any extra space.

表格的总宽度由其父容器定义.重要的是要记住,列可以收缩和拉伸.

The total width of the table is defined by its parent container. It is important to remember that a column can be both shrinkable and stretchable .

有关详细信息,您可以访问

For details information you may visit

https://developer.android.com/reference/android/widget/TableLayout.html

这篇关于android:shrinkColumns 和 android:stretchColumns 是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆