<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 填充 -->
<solid
android:color="#B2B2B2"
/>
<!-- 大小 -->
<size
android:width="200dp"
android:height="50dp"
/>
<!-- 漸變色 -->
<gradient
android:startColor="#DBDCDD"
android:endColor="#B8B9BB"
android:centerColor="#ADADAF"
android:angle="270"
/>
<!-- 描邊 -->
<stroke
android:width="2dp"
android:color="#3D4148"
/>
<!-- 圓角 -->
<corners
android:radius="5dp"
/>
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
/>
</shape>
<!--
1、 solid
描述:內部填充
屬性 android:color 填充顏色
2、size
描述:size: 大小
屬性:
android:width 表示形狀的寬度
android:height 表示形狀的高度
3、gradient
描述: 漸變色
屬性:
android:startColor 起始顏色
android:endColor 結束顏色
android:angle 漸變角度(PS:當angle=0時,漸變色是從左向右。 然後逆時針方向轉,當angle=90時爲從下往上。angle必須爲45的整數倍)
android:type 漸變類型(取值:linear、radial、sweep)
linear 線性漸變,這是默認設置
radial 放射性漸變,以開始色爲中心。
sweep 掃描線式的漸變。
android:centerColor 漸變中間顏色,即開始顏色與結束顏色之間的顏色
android:useLevel 如果要使用LevelListDrawable對象,就要設置爲true。設置爲true無漸變。false有漸變色
android:gradientRadius 漸變色半徑.當 android:type="radial" 時才使用。單獨使用 android:type="radial"會報錯。
android:centerX 漸變中心X點座標的相對位置
android:centerY 漸變中心Y點座標的相對位置
4、stroke
描述: stroke:描邊 相當於html中的盒子模型的border
屬性:
android:width 描邊的寬度
android:color 描邊的顏色
android:dashWidth 表示描邊的樣式是虛線的寬度,
值爲0時,表示爲實線。值大於0則爲虛線。
android:dashGap 表示描邊爲虛線時,虛線之間的間隔 即“ - - - - ”
5、corners
描述: corners: 圓角
屬性:
android:radius 半徑
android:topLeftRadius 左上角半徑
android:topRightRadius 右上角半徑
注意一下兩個屬性比較不同:
android:bottomLeftRadius 右下角半徑
android:bottomRightRadius 左下角半徑
6、padding
描述:內部邊距,即內容與邊的距離
屬性:
android:left 左內邊距
android:top 上內邊距
android:right 右內邊距
android:bottom 下內邊距
-->