xml控件配置属性

android:background="@drawable/shape"

标签

  • corners ----------圆角
  • gradient ----------渐变
  • padding ----------内容离边界距离
  • size ------------大小 
  • solid  ----------填充颜色
  • stroke ----------描边

注意的是corners的属性bottomLeftRadius为右下角、bottomRightRadius为左下角

shape制作圆角

<Button
android:layout_width="160dp"
android:layout_height="wrap_content"
android:background="@drawable/button_shape"
android:text="圆角按钮"
/>

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#fff"/>
<padding android:top="10px" android:bottom="10px"/>
<corners android:radius="16px"/>
<stroke android:width="1px" android:color="#000"/>
</shape>

shape制作虚线

没有dashGap属性则为实线


<View
android:layout_width="match_parent"
android:layout_height="5px"
android:layout_marginTop="10dp"
android:background="@drawable/line_shape"
/>

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line" >
<stroke
android:dashGap="3dp"
android:dashWidth="8dp"
android:width="1dp"
android:color="#63a219" />
<size android:height="1dp" />
</shape>

shape制作渐变


<View
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="@drawable/gra_shape"
/>

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" > <gradient
android:angle="270.0"
android:endColor="#ffffff"
android:startColor="#000000" /> </shape>

Android shape制作圆角、虚线、渐变的更多相关文章

  1. Android:res之shape制作圆角、虚线、渐变

    xml控件配置属性 android:background="@drawable/shape" 标签 corners ----------圆角gradient ----------渐 ...

  2. android:shape

    android:shape=["rectangle" | "oval" | "line" | "ring"] shape ...

  3. Android shape自定义形状,设置渐变色

      <?xml version="1.0" encoding="utf-8"?> <!-- android:shape=["rect ...

  4. 44.Android之Shape设置虚线、圆角和渐变学习

    Shape在Android中设定各种形状,今天记录下,由于比较简单直接贴代码. Shape子属性简单说明一下:  gradient -- 对应颜色渐变. startcolor.endcolor就不多说 ...

  5. Android GradientDrawable(shape标签定义) 静态使用和动态使用(圆角,渐变实现)

    Android GradientDrawable使用优势: 1. 快速实现一些基本图形(线,矩形,圆,椭圆,圆环) 2. 快速实现一些圆角,渐变,阴影等效果 3. 代替图片设置为View的背景 4. ...

  6. Android shape 渐变!描边!圆角!示例详解

    看看shape的用法,确实很有帮助.这里我偷懒转一篇比较详细的帖子,和大家一起进步~! Android 中常常使用shape来定义控件的一些显示属性,今天看了一些shape的使用,对shape有了大体 ...

  7. 【转】Android设置虚线、圆角、渐变

      Android虚线圆角渐变 有图又真相,先上图再说. 点击效果: 设置虚线: <?xml version="1.0" encoding="utf-8" ...

  8. Android设置虚线、圆角、渐变

    有图又真相,先上图再说. 点击效果: 设置虚线: <?xml version="1.0" encoding="utf-8"?> <shape  ...

  9. Android系列:res之shape制作

    大家好,pls call me francis. nice to me you. 本文将介绍使用在Android中使用shape标签绘制drawable资源图片. 下面的代码是shap标签的基本使用情 ...

随机推荐

  1. 浅析Java语言中两种异常的差别

    Java提供了两类主要的异常:runtime exception和checked exception.所有的checked exception是从java.lang.Exception类衍生出来的,而 ...

  2. js正则表达式的分组提取

  3. 工作总结 返回 json 后台对象中,某一个字段设为string 整个对象转换为json 返回到页面中

    JsonRequestBehavior.AllowGet作用 若要允许 GET 请求,请将 JsonRequestBehavior 设置为 AllowGet MVC 默认 Request 方式为 Po ...

  4. fastjson List<> 转Json , Json 转List<>

    SerializeWriter:相当于StringBuffer JSONArray:相当于List<Object> JSONObject:相当于Map<String, Object& ...

  5. 基于vue + axios + lrz.js 微信端图片压缩上传

    业务场景 微信端项目是基于Vux + Axios构建的,关于图片上传的业务场景有以下几点需求: 1.单张图片上传(如个人头像,实名认证等业务) 2.多张图片上传(如某类工单记录) 3.上传图片时期望能 ...

  6. sparkStreaming的mapWithState函数【案例二】

    sparkStreaming是以连续bathinterval为单位,进行bath计算,在流式计算中,如果我们想维护一段数据的状态,就需要持久化上一段的数据,sparkStreaming提供的Mapwi ...

  7. linux网络及防火墙配置命令

      /etc/sysconfig/network 包括主机基本网络信息,用于系统启动 /etc/sysconfig/network-script/ 此目录下是系统启动最初始化网络的信息 /etc/sy ...

  8. Linux 能PING IP 但不能PING 主机域名的解决方法 vim /etc/nsswitch.conf hosts: files dns wins

    Linux 能PING IP 但不能PING 主机域名的解决方法 转载 2013年12月25日 10:24:27 13749 . vi /etc/nsswitch.conf hosts: files ...

  9. IntelliJ idea——》删除tag

    查看git上所有tag E:\eju_IdeaProjects\house-platform>git tag --11v1. 20181107周三上线 20181120周二上线 v1.0.0 v ...

  10. IOS启动页动画(uiview 淡入淡出效果 )2

    Appdelegate里面右个这个函数,只要它没结束,你的等待界面就不会消失.以在启动的时候做些动画 - (BOOL)application:(UIApplication *)application ...