有時候咱們會須要圓角的按鈕或者有圓角邊框的edittext。。。。android
該怎麼作呢?通常是建個xml:code
shape.xml 代碼來自網上xml
<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <!-- 填充的顏色 --> <solid android:color="#02B4FE" /> <!-- 設置按鈕的四個角爲弧形 --> <!-- android:radius 弧形的半徑 --> <corners android:Radius="5dp" /> </shape>
OK了,可是,我須要一個只有右邊上下兩個角是圓角的按鈕該怎麼說?it
其實這樣改改就好了:io
<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <!-- 填充的顏色 --> <solid android:color="#02B4FE" /> <!-- 設置按鈕的四個角爲弧形 --> <!-- android:radius 弧形的半徑 --> <corners android:topRightRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:bottomLeftRadius="5dp" /> </shape>
android:topRightRadius 右上角class
android:bottomRightRadius 右下角
coding
android:topLeftRadius 左上角
top
android:bottomLeftRadius 左下角
di