Android删除按钮边框

时间:2016-06-19 14:07:21

标签: android button styles

我试图删除Andorid中按钮的boardes。

我知道在设计中我可以改变它: 风格= “机器人:ATTR / borderlessButtonStyle”

但是我如何在Java代码中更改它,或者在style.xml中是否存在灵魂?

1 个答案:

答案 0 :(得分:0)

试试这个

<Button
   android:background="@drawable/shape"
   android:layout_width="match_parent"
   android:layout_height="wrap_parent" />

这里是shape.xml文件代码:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <stroke android:width="1dp" android:color="#1B5E20" />
    <corners android:radius="2dp"/>
    <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

只需改变你想要的形状颜色属性..

相关问题