shape 樣式表子元素
- solid: 設(shè)置形狀填充的顏色
- padding: 設(shè)置內(nèi)容與形狀邊界的內(nèi)間距
- gradient: 設(shè)置形狀的漸變顏色
- corners: 設(shè)置圓角
- stroke: 設(shè)置描邊司恳,可描成實(shí)線或虛線
設(shè)置圓角
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> <!-- rectangle表示為矩形 -->
<!-- 填充的顏色 -->
<solid android:color="@color/white" />
<!-- 邊框的顏色和粗細(xì) -->
<stroke
android:width="1dp"
android:color="@color/blue"
/>
<!-- android:radius 圓角的半徑 -->
<corners android:radius="2dp"/>
</shape>
shape的使用
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- solid指定形狀的填充色门扇,只有android:color一個(gè)屬性 -->
<solid android:color="#2F90BD" />
<!-- padding設(shè)置內(nèi)容區(qū)域離邊界的間距 -->
<padding
android:bottom="12dp"
android:left="12dp"
android:right="12dp"
android:top="12dp" />
<!-- corners設(shè)置圓角隆豹,只適用于rectangle -->
<corners android:radius="200dp" />
<!-- stroke設(shè)置描邊 -->
<stroke
android:width="2dp"
android:color="@android:color/darker_gray"
android:dashGap="4dp"
android:dashWidth="4dp" />
</shape>
文章鏈接
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者