简体   繁体   English

Android-以编程方式设置GridLayout中按钮之间的间距

[英]Android - Set Spacing between Buttons in GridLayout programmatically

How can I change the spacing between the buttons, so there is no Space anymore? 如何更改按钮之间的间距,因此不再有空格? They are created programmatically in a GridLayout. 它们以编程方式在GridLayout中创建。

enter image description here 在此处输入图片说明

You can remove spaces using the following code: 您可以使用以下代码删除空格:

gridLayout = (GridLayout) findViewById(R.id.gridlayout);
gridLayout.setUseDefaultMargins(false);
gridLayout.setAlignmentMode(GridLayout.ALIGN_BOUNDS);
gridLayout.setRowOrderPreserved(false);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM