平等按钮宽度在视图中 [英] Equal Button Widths In A View

查看:122
本文介绍了平等按钮宽度在视图中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不这样做与目前的布局太差,但也仅仅是一件我似乎无法轻易做到。试想一下,如果你将在两,或彼此相邻三个按钮,我想他们都具有相同的大小(宽度)相对于屏幕的宽度。例如,如果屏幕为300像素每个人都成为100像素宽(假设没有边界等)。这方面的一个很好的例子是在Excel中,我将选择相邻的三列,然后点击分发单元格宽度均匀

I'm not doing too bad with layouts at the moment but there is just one piece I can't seem to do with ease. Imagine if you will two, or three buttons next to each other and I want them all to be the same size (width) relative to the width of the screen. e.g if the screen was 300 pixels each one would be 100 pixels wide (Assuming there is no boarder etc). A good example of this would be in Excel, I would select three columns next to each other and hit "Distribute cell widths evenly"

所以,我的问题。随着RelativeLayout的是有没有简单的方法来两个或多个按钮的位置,旁边,彼此都有各自的宽度自动调整,宽度是相同的,无论文字或图像。

So, my question. With a RelativeLayout is there any easy way to position two or more buttons next to each other and have their width automatically adjusted so the widths are the same regardless of text or images.

我可以用code,以获得屏幕宽度和手动设置按钮的宽度的,但我宁愿Android操作系统会自动做了。

I could use code to get the screen width and manually setup the button's width's but I'd rather the Android OS did it automatically.

推荐答案

<一个href=\"http://stackoverflow.com/questions/5459168/the-question-asked-100-000-times-how-does-one-create-buttons-with-equal-widths\">The问问题10万次:怎样才能与宽度相等创建按钮

这篇关于平等按钮宽度在视图中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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