美文网首页
Android Shape属性

Android Shape属性

作者: 十二限 | 来源:发表于2017-11-16 18:49 被阅读0次
<?xml version="1.0" encoding="utf-8"?>  
<shape xmlns:android="http://schemas.android.com/apk/res/android"  
android:shape="rectangle">  
<!-- rectangle:矩形、圆角矩形、弧形等  
    oval:圆、椭圆  
    line:线、实线、虚线  
    ring:环形 -->  

<corners  <!-- 圆角 只适用于rectangle类型-->  
    android:radius="integer"    <!-- 圆角半径 -->  
    android:bottomLeftRadius="integer"  
    android:bottomRightRadius="integer"  
    android:topLeftRadius="integer"  
    android:topRightRadius="integer" />  

<gradient  <!-- 渐变色 -->  
    <!-- 渐变的角度,线性渐变时才有效,必须是45的倍数 -->  
    android:angle="integer"  
    <!-- 渐变中心的相对X、Y坐标,放射渐变时才有效 -->  
    android:centerX="integer"  
    android:centerY="integer"  
    <!-- 渐变的半径,放射渐变(radial)时才有效-->  
    android:gradientRadius="integer"  
    <!-- 渐变开始、中心、结束的颜色 -->  
    android:startColor="color"  
    android:centerColor="integer"  
    android:endColor="color"  
    <!-- 渐变的类型 linear线性、radial放射、sweep扫描-->  
    android:type=["linear" | "radial" | "sweep"]  
    <!--  是否可在LevelListDrawable中使用 -->  
    android:useLevel=["true" | "false"] />  

<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>

另本人做了一个demo


QQ图片20180423143508.jpg QQ图片20180423143520.jpg QQ图片20180423143528.jpg QQ图片20180423143534.jpg QQ图片20180423143539.jpg

附上github地址:https://github.com/782520050/ShapeDemo.git

相关文章

  • 形状图形(shape)

    shape 常用属性 android:shape="rectangle" 矩形,默认值android:shape...

  • Shape Seclector和layor_list

    Shape 属性: Android:shape=["rectangle" | "oval" | "line" ...

  • 学习Android界面开发: Shape Drawable

    用于绘制几何形状(geometric shape)支持以下属性: 形状 android:shape...

  • android Shape 属性

    android shape 属性 半径android:innerRadius 不包含 宽度android:thic...

  • Android Shape属性

    另本人做了一个demo 附上github地址:https://github.com/782520050/Shape...

  • Android shape属性

    一.基本属性 平常使用的几个常见属性大概就是:corners、solid、stroke、gradient、padd...

  • Android shape属性

    前言 我认为小伙伴可以直接去谷歌官方文档查看,强调一下: 官方文档是中文!官方文档是中文!!官方文档是中文!!! ...

  • 安卓样式之shape(形状)

    背景形状定义工具 shape可以自定义形状 属性 android:shape 值 rectangle矩形 oval...

  • 布局基础

    一、Shape Android中shape属性详解 1. 作用 ShapeDrawable 用于定义一个基本的几何...

  • Android中shape中的属性大全

    Android中常常使用shape来定义控件的一些显示属性,今天看了一些shape的使用,对shape有了大体的了...

网友评论

      本文标题:Android Shape属性

      本文链接:https://www.haomeiwen.com/subject/nbrrvxtx.html