对准网格布局按钮 [英] Align Buttons in GridLayout

查看:144
本文介绍了对准网格布局按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的布局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屋!

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