Android 布局:如何获取剩余“列”上的按钮宽度在表行中?
我的表格布局中有几个表格行。最后一行有一个按钮,我想将其拉伸到右侧(即填充该行右侧的剩余空间)。当我尝试拉伸此按钮时,上面行中的其他按钮也会被拉伸,这是我不希望发生的情况。请参阅图像链接以了解我想要实现的目标。绿色按钮应该越过“三列”。
关于我如何做到这一点有什么建议吗?
I've got a couple of table rows in a table layout. The last row got a button which I would like to stretch out to right side (i.e. fill the remaining space on right side in the row). When I try to stretch this button, other buttons in the row above also get stretched, which I don't want to happen. See image link for what I'm trying to achieve. The green button is supposed to go over "three columns".
Any tip on how I can do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能需要为按钮和行设置
layoutSpan
属性。在您的图像中,layoutSpan
应设置为 3。编辑:
事实上,您无法为行设置
layoutSpan
,但可以为 < code>Button 相反..在我的应用程序中这是有效的。祝你好运!
You may want to set the
layoutSpan
property for your button and row. In your image thelayoutSpan
should pe set to 3..EDIT:
Indeed, you can't set
layoutSpan
for row but you can forButton
instead.. in my application this works.Good luck!
你可以尝试这样的事情
you may try something like this
您可以简单地将 2 个表排成一行,其中只有一个具有 tablestretch。
或者去看看: http://developer.android.com/参考/android/widget/TableLayout.html#attr_android:stretchColumns
You could simply have 2 tables in a row with only one of them having tablestretch.
Or go look at: http://developer.android.com/reference/android/widget/TableLayout.html#attr_android:stretchColumns