android - Android:如何在添加的按钮之间添加空格
问题描述
正如标题所述,我想在添加的按钮之间添加一些空间。
代码:
ConstraintLayout cst= (ConstraintLayout) findViewById(R.id.idButtonset);
cst.addView(this.addButton("Buttname0", R.id.svId));
Button fbutton= new Button(this);
fbutton.setText("Button 1");
Button sbutton = new Button(this);
sbutton.setText("Button 2");
cst.addView(fbutton);
cst.addView(sbutton);
问题:它将按钮添加到彼此之上。
我尝试了什么:
fbutton.setPadding(30,30,30,30);
sbutton.setPadding(40,35,40,35);
问题:不支持边距,填充 - 有效,但它没有在添加的按钮之间创建空间。
问题:如何添加 Buttons 以在它们之间添加空格?
解决方案
推荐阅读
- okta - 用于 API 访问的 OKTA 令牌
- java - 如何通过Apache POI更改Excel旭日形图中点的图形属性
- angular - Angular 6 String Interpolation 未使用 .subscribe() 中的值更新
- php - 如果用户登录,显示一个主题,如果没有显示没有主题?
- bash - 为每个进程使用不同的脚本参数运行 mpiexec
- android - kotlin 1.2.70 和 Android Room 不兼容
- neural-network - 用于连续 DV 的神经网络隐藏节点
- javascript - 扁平化嵌套对象的简洁 es6 方式是什么?
- javascript - 一行中有多个分号
- html - 在 CSS 中合并菱形和六边形?