当前位置: 移动技术网 > 移动技术>移动开发>Android > 【Android shape】 之  圆环 的三种实现方法

【Android shape】 之  圆环 的三种实现方法

2020年07月08日  | 移动技术网移动技术  | 我要评论
【Android shape】 之 圆环 的三种实现方法自定义 背景时,常用到 shape 的方法,今天总结记录一下,用 shape 画圆环的三种方式:方法一:<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerRadiusRatio="3" android...

【Android shape】 之  圆环 的三种实现方法

 

自定义 背景时,常用到 shape 的方法,今天总结记录一下,用 shape 画圆环的三种方式: 

 


方法一:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadiusRatio="3"
    android:shape="ring"
    android:thicknessRatio="8"
    android:useLevel="false">
    <gradient
        android:centerColor="#ff0000"
        android:endColor="#0ff676"
        android:startColor="#B23AEE"
        android:useLevel="false" />
</shape>

 

方法二:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval"
    android:useLevel="false">
    <stroke
        android:width="2dp"
        android:color="#ff0000" />
    <size
        android:width="20dp"
        android:height="20dp" />
</shape>

 

方法三:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadius="100dp"
    android:shape="ring"
    android:thickness="10dp"
    android:useLevel="false">
    <stroke
        android:width="10dp"
        android:color="#ff6652" />
  
</shape>

 

 

本文地址:https://blog.csdn.net/MLQ8087/article/details/107164310

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网