(android) 占据屏幕整个宽度的按钮行
我正在尝试制作 3 行,每行 4 个按钮,每个按钮将占据屏幕的整个宽度。我尝试过线性布局,但在添加第二行时遇到困难,并且从我读到的内容来看,嵌套线性布局是不好的做法。我多次尝试使用相对布局,但无法设法让按钮填充屏幕宽度,因为它忽略了layout_weight,然后我尝试在相对布局中嵌套线性布局,但layout_weight仍然被忽略。
实现这一目标的最佳方法是什么?
I am trying to make 3 rows of 4 buttons each that will take up the entire width of the screen. I have tried Linear Layout but have trouble adding a second row and from what I have read nesting Linear Layouts is bad practice. I tried to use relative layout several times but I cannot manage to get the buttons to fill the width of the screen because it ignores layout_weight, I then tried nesting linear layout in relative layout but layout_weight is still ignored.
What is the best way to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下
TableRow
应该没问题。Take a look at
TableRow
and you should be fine.