Android xml 按钮有一个漂亮的边框
Android xml button has a fine border to it
第一次尝试 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"
/>
我不能post一张图片,因为声誉低。*
如何去除按钮周围的细线?
选择的主题是 Material Black 如果有帮助的话。
制作您自己的 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"
/>
如果你想删除按钮后面的边框,使用这个
style="?android:attr/borderlessButonStyle"
第一次尝试 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"
/>
我不能post一张图片,因为声誉低。*
如何去除按钮周围的细线?
选择的主题是 Material Black 如果有帮助的话。
制作您自己的 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"
/>
如果你想删除按钮后面的边框,使用这个 style="?android:attr/borderlessButonStyle"