android 背景边框变圆角
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="5dip" android:color="#FFFF00" /><!-- 描边 :边框宽度与颜色 -->
<padding android:left="20dip" android:top="0dip" android:right="0dip" android:bottom="0dip" /><!-- 主要内容的padding 文字距离上下左右的距离 -->
<corners android:topLeftRadius="15dip"
android:topRightRadius="15dip"
android:bottomLeftRadius="0dip"
android:bottomRightRadius="0dip"/><!-- 圆角的半径 也可以统一设置半径 android:radius="9dip"-->
<gradient android:startColor="#ff8c00" android:endColor="#FFFFFF" android:angle="270" /> <!-- 渐变 -->
<solid android:color="#FFEFD5" /> <!-- 没有描边的中间部分 --><!--solid 与 gradient 只能显示在代码最后那个-->
</shape>
Android视图圆角背景
本文介绍如何使用XML定义一个带有圆角、描边及渐变效果的Android视图背景。通过具体参数设置,实现顶部圆角底部平直的效果,并包含从橙色到白色的渐变色填充。

被折叠的 条评论
为什么被折叠?



