当前位置:网站首页>Shape color gradient, fillet, half fillet, border, fill

Shape color gradient, fillet, half fillet, border, fill

2022-06-10 13:04:00 yechaoa

design sketch :

1、shape:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Round corners -->
    <corners
        android:radius="5dp"
        android:topLeftRadius="30dp"
        android:bottomRightRadius="30dp"/>

    <!-- Fill color -->
    <solid android:color="#000"/>

    <!-- Frame -->
    <stroke
        android:color="#808080"
        android:width="2dp"/>

    <!-- The gradient -->
    <gradient
        android:startColor="#f52"
        android:centerColor="#f92"
        android:endColor="#fe2"
        android:angle="180"/>

</shape>

The gradient color highlights the fill color , So it can be removed solid Of

2、 About gradient Of angle Parameters :

0 It's from left to right

90 It's from the bottom up

180 Right to left

270 It's from top to bottom

360==0

3、 One more type Parameters :

linear Linear gradient ( Default )

radial Circular gradient

sweep Fan gradient

Gradients usually give a start color and an end color , Then specify the direction

4、 Half round on both sides :

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <corners android:radius="999dp"/>

    <stroke
        android:width="1dp"
        android:color="@color/colorPrimary"/>

    <padding
        android:bottom="10dp"
        android:left="20dp"
        android:right="20dp"
        android:top="10dp"/>

</shape>
原网站

版权声明
本文为[yechaoa]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101133345543.html