我有 4 个按钮,横跨一个水平方向的线性布局,它们均匀加权以在屏幕的宽度上分割它们,但为了改善外观,并清楚地定义按钮的轮廓,我想设置边框按钮,但无法弄清楚如何! (我知道,这很可悲!)
我环顾四周,找不到答案 - 抢分! 这是按钮的属性:
<Button
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/dot"
android:id="@+id/dot"
android:layout_width="0dp"
android:background="@color/Button_Color"
android:clickable="true"
android:onClick="SelectDot"/>
提前致谢!
最佳答案
如果您只想分隔按钮,请在按钮定义中添加一个 layout_margin 属性,例如:
android:layout_margin="10dp"
如果您想要围绕按钮边缘的实际描边线,这里是创建它的快速方法:http://angrytools.com/android/button/
只需在其中设计您想要的内容并将 xml 复制到您的文件即可。
关于android - 为按钮分配边框属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39839781/