Android xml按钮有一个很好的边框

时间:2015-07-27 13:02:08

标签: android xml user-interface button

第一次去Android应用程序。

我使用XML在界面上添加了一个按钮。将stlye设置为标准Widget.Button。

按钮的XML:

 <Button
        android:id="@+id/Button"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        style="@android:style/Widget.Button"
        android:text="Help me !"
        android:layout_gravity="center"
        />

由于声誉低,我无法发布图片。*

如何删除按钮周围的小线?

如果对所有内容有帮助,则所选主题为素材黑色。

2 个答案:

答案 0 :(得分:0)

创建自己的xml样式文件并将其放在可绘制的文件夹中,如下所示...(例如style1.xml)

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#31B6E7" />    
<stroke android:width="1.5dp" //This change the surrounding lines width
    android:color="#31B6E7" />

<corners
android:radius="2dp"/>

</shape> 

然后在按钮中设置你的风格..

<Button
     android:id="@+id/Button"
     android:layout_width="200dp"
     android:layout_height="wrap_content"
     android:backgroung="@drawable/style1"
     android:text="Help me !"
     android:layout_gravity="center"
 />

答案 1 :(得分:0)

如果要删除按钮后面的边框,请使用此按钮  风格=&#34;机器人:?ATTR / borderlessButonStyle&#34;