美文网首页
android shape的使用

android shape的使用

作者: Jwennnnnnnnnn | 来源:发表于2016-09-08 10:04 被阅读0次

<xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">

<!–渐变–>

<gradient

android:startColor="@android:color/white"

android:centerColor="@android:color/black"

android:endColor="@android:color/black"

android:useLevel="true"

android:angle="45"

android:type="radial"

android:centerX="0"

android:centerY="0"

android:gradientRadius="90"/>

<!–圆角–>

<corners

android:radius="9dp"

android:topLeftRadius="2dp"

android:topRightRadius="2dp"

android:bottomLeftRadius="2dp"

android:bottomRightRadius="2dp"/><!–设置圆角半径–>

<!–间隔–>

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

android:dashGap="2dp"/>

</shape–>

填充:设置填充的颜色

间隔:设置四个方向上的间隔

大小:设置大小

圆角:同时设置五个属性,则Radius属性无效

android:Radius="20dp"                           设置四个角的半径

android:topLeftRadius="20dp"              设置左上角的半径

android:topRightRadius="20dp"           设置右上角的半径

android:bottomLeftRadius="20dp"      设置右下角的半径

android:bottomRightRadius="20dp"    设置左下角的半径

描边:dashWidth和dashGap属性,只要其中一个设置为0dp,则边框为实现边框

android:width="20dp"                               设置边边的宽度

android:color="@android:color/black"  设置边边的颜色

android:dashWidth="2dp"                         设置虚线的宽度

android:dashGap="20dp"                          设置虚线的间隔宽度

渐变:当设置填充颜色后,无渐变效果。angle的值必须是45的倍数(包括0),仅在type="linear"有效,不然会报错。android:useLevel 这个属性不知道有什么用。

angle对应值的起点如图:

相关文章

  • Android中shape中的属性大全

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

  • Android shape使用笔记

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

  • ShapeDrawable的基本探索

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

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

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

  • Android-Shape

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

  • 形状图形(shape)

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

  • Android Shape使用

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

  • Android Shape学习

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

  • android shape的使用

  • Android shape的使用

    填充:设置填充的颜色间隔:设置四个方向上的间隔大小:设置大小圆角:同时设置五个属性,则Radius属性无效andr...

网友评论

      本文标题:android shape的使用

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