本篇内容主要讲解“怎么实现Android shape半圆与1/4圆”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么实现Android shape半圆与1/4圆”吧!
size:宽高比1:2是垂直半圆,宽高比2:1是水平半圆。
corners:4个角的任意两个角度(不小于宽高最小值)相同,且在同一边(上下左右)
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--渐变填充-->
<gradient
android:endColor="#3bf8fffd"
android:startColor="#fff3fefc"
android:type="linear"
android:angle="135"
android:useLevel="true" />
<!--单色填充-->
<!--<solid android:color="#ffffff"/>-->
<!--宽高比1:2是垂直半圆,宽高比2:1是水平半圆-->
<size
android:width="20dp"
android:height="40dp" />
<!--4个角的任意两个角度(不小于宽高最小值)相同,且在同一边(上下左右)
如bottomLeftRadius,topLeftRadius都在左边,则为左半圆-->
<corners
android:bottomLeftRadius="20dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="20dp"
android:topRightRadius="0dp" />
</shape>
size:宽高比1:1是1/4圆
corners:4个角的任意一个角度,不小于宽高值
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--渐变填充-->
<gradient
android:angle="90"
android:endColor="#3bf8fffd"
android:startColor="#fff3fefc"
android:type="linear"
android:useLevel="true" />
<!--单色填充-->
<!--<solid android:color="#ffffff"/>-->
<!--宽高比1:1是1/4圆-->
<size
android:width="55dp"
android:height="55dp" />
<!--4个角的任意一个角度,不小于宽高值-->
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="55dp"
android:topRightRadius="0dp" />
</shape>
到此,相信大家对“怎么实现Android shape半圆与1/4圆”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:http://blog.itpub.net/69978258/viewspace-2710238/