---
title: "android 背景边框变圆角"
author: "mmdev"
date: "2013-01-17T18:31:00Z"
tags: []
slug: "android"
draft: false
lastmod: "2013-01-29T10:47:57Z"
id: 1777511
url: "https://mmdev.iteye.com/blog/1777511"
---

# [android 背景边框变圆角](http://www.cnblogs.com/lhxin/archive/2012/04/16/2451246.html)

&lt;?xml version="1.0" encoding="utf-8"?&gt;

&lt;shape xmlns:android="[http://schemas.android.com/apk/res/android](http://schemas.android.com/apk/res/android)"&gt;

&lt;stroke android:width="5dip" android:color="#FFFF00" /&gt;&lt;!-- 描边 ：边框宽度与颜色 --&gt;  
&lt;padding android:left="20dip" android:top="0dip" android:right="0dip" android:bottom="0dip" /&gt;&lt;!-- 主要内容的padding 文字距离上下左右的距离 --&gt;  
&lt;corners android:topLeftRadius="15dip"  
android:topRightRadius="15dip"  
android:bottomLeftRadius="0dip"  
android:bottomRightRadius="0dip"/&gt;&lt;!-- 圆角的半径 也可以统一设置半径 android:radius="9dip"--&gt;

&lt;gradient android:startColor="#ff8c00" android:endColor="#FFFFFF" android:angle="270" /&gt; &lt;!-- 渐变 --&gt;  
&lt;solid android:color="#FFEFD5" /&gt; &lt;!-- 没有描边的中间部分 --&gt;&lt;!--solid 与 gradient 只能显示在代码最后那个--&gt;  
&lt;/shape&gt;