圆形:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solid android:color="@color/deep_gray" />
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<solid android:color="@color/backg_gray" />
<size
android:width="30dp"
android:height="30dp" />
</shape>

效果图:



转圈圈:

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" > <shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="10"
android:useLevel="false" >
<gradient
android:centerColor="#FF6A6A"
android:endColor="#FF0000"
android:startColor="#FFFFFF"
android:type="sweep" />
</shape> </rotate>

效果图, 会转圈圈:

注意:如果在控件中没有设置宽和高,例如:控件设置了wrap_content,就需要在shape中设置宽和高:

<size
android:width="30dp"
android:height="30dp" />

完整代码:

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" > <shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="10"
android:useLevel="false" >
<gradient
android:centerColor="@color/backg_gray"
android:endColor="@color/deep_gray"
android:startColor="#FFFFFF"
android:type="sweep" /> <size
android:width="30dp"
android:height="30dp" /> </shape> </rotate>

Android-shape圆形&转圈圈的更多相关文章

  1. Android - shape圆形画法(oval)

    shape圆形画法(oval) 本文地址: http://blog.csdn.net/caroline_wendy 1. 创建一个目录drawable, 用于存放xml类型的图片资源; 2. 在dra ...

  2. ANDROID SHAPE画圆形背景_ANDROID实现角标布局

    ANDROID SHAPE画圆形背景_ANDROID实现角标布局 <?xml version="1.0" encoding="UTF-8"?> &l ...

  3. android:shape 设置圆形

    组件高度和宽度设置为相同的值即可<?xml version="1.0" encoding="utf-8"?><shape xmlns:andr ...

  4. Android (shape,gradient)使用总结

    设置背景色可以通过在res/drawable里定义一个xml,如下: <?xml version="1.0" encoding="utf-8"?> ...

  5. android shape.xml 文件使用

    设置背景色可以通过在res/drawable里定义一个xml,如下: <?xml version="1.0" encoding="utf-8"?> ...

  6. 32、详解Android shape的使用方法(转载)

    0.java绘制shape 在官方API介绍中: ShapeDrawable:This object can be defined in an XML file with the <shape& ...

  7. android shape图形优化Button效果

    android shape可以让我们通过定义xml文件的方式创建图形,当然只能实现一些比较简单的图形(圆形,矩形,椭圆,线段),但是已经相当不错了,通过shape创建的图形作为控件的背景已经基本可以满 ...

  8. Android shape与selector标签使用

    原文地址:Android shape与selector标签使用 Android中提供一种xml的方式,让我们可以自由地定义背景,比较常用的就是shape标签和selector标签 shape shap ...

  9. android shape使用总结

    今天使用到shape,这个里面有很多属性,在这里我记录一下各个属性的使用的情况以及所代表的意思 <?xml version="1.0" encoding="utf- ...

随机推荐

  1. Android 菊花加载工具类

    先看看实现效果图 1.首先自定义一个类继承系统ProgressDialog /** * Created by hanbao0928 on 2018/11/1. */ public class Dial ...

  2. 51单片机学习笔记(清翔版)(21)——ADDA数模转换

    A:anolog模拟的         D:digital数字的 AD模拟转数字,DA数字转模拟 生活中的基本都是模拟量,如温度,可以是10℃,10.1℃等 手机的背光亮度自动调节,拿到太阳光下,亮度 ...

  3. android 7.0+ FileProvider 访问隐私文件 相册、相机、安装应用的适配

    从 Android 7.0 开始,Android SDK 中的 StrictMode 策略禁止开发人员在应用外部公开 file:// URI.具体表现为,当我们在应用中使用包含 file:// URI ...

  4. mysql执行sql语句过程

    开发人员基本都知道,我们的数据存在数据库中(目前最多的是mysql和oracle,由于作者更擅长mysql,所以这里默认数据库为mysql),服务器通过sql语句将查询数据的请求传入到mysql数据库 ...

  5. MySQL 聚合函数 控制流程函数

    常用的聚合函数 1. AVG() 求平均值 mysql> AVG([DISTINCT] expr) -- 返回 expr 的平均值 mysql> select AVG(age) from ...

  6. Python_格式化字符

    %% 百分号标记 #就是输出一个%%c 字符及其ASCII码%s 字符串 %r 是不管是什么打印出来%d 有符号整数(十进制)%u 无符号整数(十进制)%o 无符号整数(八进制)%x 无符号整数(十六 ...

  7. STS中poem.xml配置文件

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  8. WebDriver中的操作使用

    1.WebDriver中使用jquery假如设定jquery包的路径为path,则程序如下: String jquery=null; FileInputStream input = new FileI ...

  9. Python学习——1

    我是一名刚入IT行业的小白,目前主要是做网络运维这一块.曾经总是认为我是做网络运维的,学习代码干啥啊?后来就慢慢发现,传统的运维方式让我的效率好像不如别人效率高,关键还TM看别人比我更轻松.每一个网络 ...

  10. Filter笔记

    1.Filter [1] Filter简介 > Filter翻译为中文是过滤器的意思. > Filter是JavaWeb的三大web组件之一:Servlet.Filter.Listener ...