Android去掉Button自帶樣式

Button自帶樣式:有灰邊框


button.jpg

去掉樣式自定義:


button.jpg

1.布局中代碼

<Button
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/btn_backgroung"
                    style="?android:attr/borderlessButtonStyle"
                    android:text="兌換獎(jiǎng)品"
                    android:textColor="#FFFFFF"
                    android:textSize="@dimen/sp_18" />

style="?android:attr/borderlessButtonStyle" 是去掉默認(rèn)灰邊

2.自定義背景btn_backgroung.xml
在drawable中新建btn_backgroung.xml

<?xml version="1.0" encoding="utf-8"?>
    <shape android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">
        <gradient android:type="linear" android:useLevel="true" android:startColor="#D8D8D8"  android:endColor="#ffF0F0F0" android:angle="135" />
        <corners android:radius="50dp" />
    </shape>

這樣一個(gè)圓角漸變色的Button就出來了,自己修改各項(xiàng)參數(shù)即可

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容