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设备要向微软支付专利费
  2. canvas.drawRoundRect方法,绘制圆角矩形
  3. a64_7.1-v3.1android拉伸绘制矩形区域距离默认平板外边界问题
  4. 微软和Wistron再度联手,Android和Chrome OS又成鱼肉
  5. Android设备到底侵犯了微软的什么专利
  6. android在java代码中绘制矩形框
  7. a64_7.1android平板关于更改绘制矩形界面透明度
  8. Android 圆角矩形ImageView

随机推荐

  1. android 和JS互调
  2. Android第一周
  3. 理解onMeasure
  4. Android 中文 API (29) —— CompoundButto
  5. android 6.0-高通视频通话拨打流程
  6. Android.Tools.Summary
  7. Android 设置EditText光标Curso颜色及粗
  8. Android B/S 关于系统兼容性相关问题
  9. Android(安卓)获取目录下所有文件、获取
  10. Android(安卓)Studio 2.0 正式版发布啦 (