Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
通过为每个按钮赋予 1 的权重,我得到了 7 个在布局中水平对齐的按钮。但是,这会拉伸按钮,因此在屏幕上占用相同数量的空间。我需要按钮保持良好的纵横比,并且仍然通过利用按钮之间的空白来占据整个宽度。这可能与重量有关吗?
如果您想拉伸的不是按钮而是它们周围的空间,请将按钮放在容器上并为其设置权重。另请查看 TableLayout 和 GridLayout。