有时候咱们会须要圆角的按钮或者有圆角边框的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