1.在drawable 下新建 shape.xml 文件


<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle" ><!-- 填充的颜色 --> <solid android:color="#FFFFFF" /><!-- 设置矩形的四个角为弧形 --><!-- android:radius 弧形的半径 --><corners android:radius="7dip" /></shape>


android:radius为角的弧度,值越大角越圆。

我们还可以把四个角设定成不同的角度,方法为:

<corners android:bottomLeftRadius="20dp"android:bottomRightRadius="0dp" android:topLeftRadius="1dp"android:topRightRadius="20dp" />

2.1设置成0dp无效,2.1以上版本可以,如果无效的话那就只能设成1dp了。


2.设置引用

android:background="@drawable/shape"

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"   android:layout_width="fill_parent"   android:layout_height="fill_parent"   android:orientation="vertical" >   <EditText  android:layout_width="fill_parent"  android:layout_height="wrap_content"    android:background="@drawable/shape"   android:drawableLeft="@drawable/ic_launcher"   android:drawablePadding="5dp"    android:hint="Hello Android"     android:padding="5dp" /></LinearLayout>


更多相关文章

  1. android boot 代码流程
  2. Xamarin Mono For Android(安卓)4.6.07004看不到新建android
  3. ANDROID问题总结
  4. 7715平台修改BUG记录
  5. Android初步了解入门
  6. 使用Android(安卓)SwipeRefreshLayout了解Android的嵌套滑动机制
  7. 【Android经典入门教程-下(bill译)】
  8. android 五大布局经典演绎
  9. Android字体加粗

随机推荐

  1. PHP中钩子函数的实现与认识
  2. PHP5.4.0新特性研究
  3. 如何在没有显示ID的情况下唯一识别记录?
  4. 来自php表单的样式电子邮件
  5. PHP开发微信支付代码及支付通知处理
  6. 使用CodeIgniter更新MySQL表中的行。
  7. php GD库生成验证码
  8. PHP中出现BOM字符\ufeff,PHP去掉诡异的BO
  9. 从JSON字符串/数组中提取第一个图像
  10. PHP & GD -透明背景填充附近的颜色。