android shape

顶部两个圆角
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <!-- rectangle表示为矩形 -->
    <!-- 填充的颜色 -->
    <solid android:color="#EEEEEE" />
    <!-- 边框的颜色和粗细 -->
    <stroke
        android:width="1dp"
        android:color="#EEEEEE"
        />
    <!-- android:radius 圆角的半径 -->
    <corners
        android:radius="2dp"
        android:topLeftRadius="@dimen/dp_10"
        android:topRightRadius="@dimen/dp_10"
        android:bottomRightRadius="@dimen/dp_0"
        android:bottomLeftRadius="@dimen/dp_0"
        />

</shape>
属性介绍

android:topLeftRadius="@dimen/dp_10"//左上角半径
android:topRightRadius="@dimen/dp_10"//右上方的半径
android:bottomRightRadius="@dimen/dp_0"//右下角半径
android:bottomLeftRadius="@dimen/dp_0"//左下半径

渐变色

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:angle="90"
        android:endColor="#2196F3"
        android:startColor="#D203D8F4" />
</shape>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容