1.shape的基本使用
根據官方給出的API整理的:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape=["rectangle"//矩形 | "oval"//橢圓 | "line"//線 | "ring"//圓環] >
<corners//圓角
android:radius="integer"
android:topLeftRadius="integer"
android:topRightRadius="integer"
android:bottomLeftRadius="integer"
android:bottomRightRadius="integer" />
<gradient//漸變
android:angle="integer"//漸變角度0:左到右;90:下到上;180:右到左;270:上到下
android:centerX="integer"//表示漸變的X軸起始位置,範圍0-1,0.5表示圓心。
android:centerY="integer"
android:centerColor="integer"
android:endColor="color"
android:gradientRadius="integer"
android:startColor="color"
android:type=["linear"//線性漸變 | "radial"//放射漸變 | "sweep"//掃描性漸變]//漸變類型
android:useLevel=["true" | "false"]//一般爲flase/>
<padding//內邊距
android:left="integer"
android:top="integer"
android:right="integer"
android:bottom="integer" />
<size
android:width="integer"
android:height="integer" />
<solid//填充色
android:color="color" />
<stroke//邊框
android:width="integer"
android:color="color"
android:dashWidth="integer"//虛線間距寬度
android:dashGap="integer"//虛線寬度 />
</shape>