<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:dither="false|true" //將在位圖的像素配置與屏幕不同時(例如:ARGB 8888 位圖和 RGB 565 屏幕)啟用位圖的抖動;值為“false”時則停用抖動。默認(rèn)值為 true。
android:shape="rectangle|line|oval|ring"http://分別為矩形、線、橢圓、環(huán)。默認(rèn)為矩形rectangle
android:innerRadius="integer" // shape為ring時可用,內(nèi)環(huán)半徑
android:innerRadiusRatio="float" // shape為ring時可用,內(nèi)環(huán)的厚度比,即環(huán)的寬度比表示內(nèi)環(huán)半徑,默認(rèn)為3,可被innerRadius值覆蓋
android:thickness="integer" // shape為ring時可用,環(huán)的厚度
android:thicknessRatio="float" // shape為ring時可用,環(huán)的厚度比,即環(huán)的寬度比表示環(huán)的厚度,默認(rèn)為9,可被thickness值覆蓋
android:tint="color" // 給shape著色
android:tintMode="src_in|src_atop|src_over|add|multiply|screen" // 著色類型
android:useLevel="false|true" // 較少用,一般設(shè)為false,否則圖形不顯示。為true時可在LevelListDrawable使用
android:visible="false|true"
>
<!-- 圓角 -->
<corners
android:radius="integer" // 圓角半徑,該值設(shè)置時下面四個屬性失效
android:bottomLeftRadius="integer" // 左下角圓角半徑
android:bottomRightRadius="integer" // 右下角圓角半徑
android:topLeftRadius="integer" // 左上角圓角半徑
android:topRightRadius="integer" // 右上角圓角半徑
/>
<!-- 漸變 -->
<gradient
android:useLevel="false|true" // 與上面shape中該屬性的一致
android:type="linear|radial|sweep" // 漸變類型,分別為線性、放射性、掃描性漸變,默認(rèn)為線性漸變linear
android:angle="integer" // 漸變角度,當(dāng)上面type為線性漸變linear時有效。角度為45的倍數(shù),0度時從左往右漸變,角度方向逆時針
android:centerColor="color" // 漸變中間位置顏色
android:startColor="color" // 漸變開始位置顏色
android:endColor="color" // 漸變結(jié)束位置顏色
android:centerX="float" // type為放射性漸變radial時有效,設(shè)置漸變中心的X坐標(biāo),取值區(qū)間[0,1],默認(rèn)為0.5,即中心位置
android:centerY="float" // type為放射性漸變radial時有效,設(shè)置漸變中心的Y坐標(biāo),取值區(qū)間[0,1],默認(rèn)為0.5,即中心位置
android:gradientRadius="integer" // type為放射性漸變radial時有效,漸變的半徑
/>
<!-- 內(nèi)邊距 -->
<padding
android:bottom="integer" // 設(shè)置底部邊距
android:left="integer" // 左邊邊距
android:right="integer" // 右邊
android:top="integer" // 頂部
/>
<!-- 大小 -->
<size
android:height="integer" // 寬度
android:width="integer" // 高度
/>
<!-- 填充 -->
<solid
android:color="color" // shape的填充色
/>
<!-- 描邊 -->
<stroke
android:color="color" // 描邊的顏色
android:width="integer" // 描邊的寬度
android:dashGap="integer" // 虛線間隔
android:dashWidth="integer" // 虛線寬度
/>
</shape>
以上作為筆記用來記錄
要說一下幾個東西
android:innerRadius="integer" ①
android:innerRadiusRatio="float" ②
android:thickness="integer" ③
android:thicknessRatio="float" ④
12互斥 1>2
34互斥 3>4
13是具體的值,24是比例
android:useLevel="false|true"
這個我不是很懂,只知道當(dāng) android:shape="ring"時,才有影響,此時android:useLevel="false"圖形才會顯示?。。?br>
至于LevelListDrawable我還不是很懂,再研究研究~