美文网首页Android学习笔记
Android shape使用笔记

Android shape使用笔记

作者: Viking_Den | 来源:发表于2016-09-18 15:10 被阅读35次

Android中常常使用shape来定义控件的一些显示属性,今天看了一些shape的使用,对shape有了大体的了解,稍作总结。
具体代码中使用:

xml.png
  • shape
    android:shape=["rectangle" | "oval" | "line" | "ring"]
    其中rectagle矩形,oval椭圆,line水平直线,ring环形
    shape的子节点有六个:gradient、corners、paddings、size、solid、stroke。
  • gradient-渐变
    android:startColor:起始颜色
    android:endColor:结束颜色
    android:angle:渐变角度,必须为45的整数倍
    android:type:渐变模式,设置为"linear"时,即线性渐变;"radial"时为径向渐变,径向渐变需要指定半径,如android:gradientRadius="50"
  • corners-圆角
    可以设置四个圆角,也可以单独分别设置。
    android:radius="5dp",设置四个角的圆角半径为5dp
    android:topRightRadius="20dp",右上角
    android:bottomLeftRadius="20dp",右下角
    android:topLeftRadius="1dp",左上角
    android:bottomRightRadius="0dp",左下角
  • padding-内边距
    这个和设置Widget一样
    *size-大小
    设置shape的长宽
  • solid-实心,就是填充的意思
    android:color,指定填充的颜色
  • stroke-描边
    android:width, 描边的宽度
    android:color,描边的颜色
    android:dashWith,设置一个描边虚线的宽度
    android:dashGap,设置描边虚线的间隔,当设置为0时,即实线

相关文章

  • Android shape使用笔记

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

  • Android中shape中的属性大全

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

  • ShapeDrawable的基本探索

    在XML中使用标签编辑shape drawable 直接阅读Android官方文档有详细介绍And...

  • android:shape="line"画一条线

    使用android:shape="line"画一条线

  • 形状图形(shape)

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

  • Android-Shape

    Android-Shape shape一个用来定义形状的工具,或者说使用画图的,图片用于做背景图。 shape定义...

  • Android Shape使用

    说明 在Android开发中,使用shape可以很方便的帮我们画出想要的背景,相对于png图片来说,使用shape...

  • Android Shape学习

    在Android开发中,使用shape可以很方便的帮我们画出我们想要的背景,相对于png等图片来说,使用shape...

  • Android中shape的简单介绍

    均属于笔记,仅供个人参考,有问题欢迎指正,整理模式 Android中使用shape来定义控件的一些简单显示属性,如...

  • Android学习笔记043之shape详解

    Android中提供了shape形状给我们使用,我们可以通过shape画出虚线、圆角、渐变等多种效果,而且,sha...

网友评论

    本文标题:Android shape使用笔记

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