Android-Shape标签使用

前言

工作随笔,方便记起

1.shape的属性
<shape  android:shape="line" >          <!--线形-->
<shape  android:shape="oval" >          <!--圆角 -->
<shape  android:shape="rectangle" >     <!--矩形-->
<shape  android:shape="ring" >          <!--环形-->
2.shape有6个子标签,各属性如下
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
  android:shape="line">

  <!-- 圆角 -->
  <corners
      android:radius="9dp"
      android:topLeftRadius="2dp"
      android:topRightRadius="2dp"
      android:bottomLeftRadius="2dp"
      android:bottomRightRadius="2dp"/><!-- 设置圆角半径 -->

  <!-- 渐变 -->
  <!--["linear" | "radial" | "sweep"] 3中渐变类型,线性渐变(默认)/放射渐变/扫描式渐变  -->
  <gradient
      android:type="radial"
      android:startColor="@android:color/white"
      android:centerColor="@android:color/black"
      android:endColor="@android:color/black"
      android:useLevel="true"
      android:angle="45"
      android:centerX="0"    <!--渐变中心X的相当位置,范围为0~1-->
      android:centerY="0"    <!--渐变中心Y的相当位置,范围为0~1-->
      android:gradientRadius="90"/>

  <!-- 间隔 -->
  <padding
      android:left="2dp"
      android:top="2dp"
      android:right="2dp"
      android:bottom="2dp"/><!-- 各方向的间隔 -->

  <!-- 大小 -->
  <size
      android:width="50dp"
      android:height="50dp"/><!-- 宽度和高度 -->

  <!-- 填充 -->
  <solid
      android:color="@android:color/white"/><!-- 填充的颜色 -->

  <!-- 描边 -->
  <stroke
      android:width="2dp"
      android:color="@android:color/black"
      android:dashWidth="1dp"    <!--虚线的宽度,值为0时是实线 -->
      android:dashGap="2dp"/>    <!--虚线的间隔  -->

</shape>
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 177,166评论 25 709
  • 粤人称为椰菜,因为像椰子.北方称之甘蓝、包心菜、洋白菜.闽南及台湾称其为高丽菜! 洋人多煲汤 德国酸菜丝 高丽腌制...
    Taofca阅读 3,222评论 0 0
  • 去东北旅游,说了好久,今天总算成行。凌晨四点,导游就把大家从睡梦中叫醒。出得铁路饭店,古城墙庄严肃穆,一轮圆月在云...
    林奇_51f7阅读 4,463评论 0 1
  • 开源节流 降本增效】工艺所:以技术创新推动降本增效 2018/5/6 5:00 页面内容技术穿新推动将本增长 20...
    北方的海洋阅读 1,121评论 0 0
  • 微信公众号原文 系统:Windows 7软件:Excel 2010 / Access 2010 这个系列开展一个新...
    Data_Python_VBA阅读 5,033评论 0 0

友情链接更多精彩内容