对准网格布局按钮 [英] Align Buttons in GridLayout
问题描述
我的布局code和它的图形重新presentation是:
My layout code and its graphical representation is:
这只是一个例子,我有大约30 按钮
我在网格布局
应用程序。
我希望我的按钮
来填补他们的整个单元网格和网格的列应在偶数宽度/高度。
This is just an example, I have about 30 Buttons
in my application inside a GridLayout
.
I want my Buttons
to fill their entire cell in the grid and the grid's columns should be in even width/height.
我似乎无法做到这件事,任何帮助将受到欢迎。
I cant seem to get it done, any help would be welcome.
推荐答案
我没有使用网格布局
来很多可取有关使用它的东西,我可以推荐你是使用 TableLayout
。我这样说是因为你的布局在<$ C $ C> TableLayout 的范围pretty很合身,网格布局
的文档这似乎是一个问题:
I haven't use GridLayout
to much to recommend something about using it, what I can recommend you is to use a TableLayout
. I say this because your layout fits in the TableLayout
's scope pretty well and after a quick browsing of GridLayout
's documentation this seems like a problem:
的网格布局并不体重的原则提供支持,如重定义。在一般情况下,它是不因此可以配置一个GridLayout的多个部件之间的分配过量的空间。的
还有网格布局
在 ICS引入
。
您可以通过查看您的布局为例 TableLayout
这里:
You can see an example for your layout using TableLayout
here:
https://gist.github.com/3788301
如果你不想表填满整个高度然后将其删除 weigthSum
属性 TableLayout
和 layout_weight =1
从 TableRows
。
If you don't want the table to fill the entire height then remove the weigthSum
property from the TableLayout
and layout_weight="1"
from the TableRows
.
这篇关于对准网格布局按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!