shape的作用
在Android程序开发中,我们有时想使用特别的图形,而android studio中提供的图形有限,这时就可以使用Shape这个东西去定义各种各样的形状,Android允许通过xml定义资源,常见的有string、id、integer、dimen等、也可以定义一些图片资源。用shape可以做几何的矢量图,使界面更加有特色。
shape的基本语法
我们可以先看官方文档中的shape基本语法示例:
<?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"
android:centerX="float"
android:centerY="float"
android:centerColor="integer"
android:endColor="color"
android:gradientRadius="integer"