在很多android的应用程序中,我们经常可以看到圆角的文本编辑框,那是怎么实现的呢?就像下图这种:

解决方案来自于CSDN问答,以下只是其中一种,更多方法见http://ask.csdn.net/questions/885

需要两个shape绘制文件

对于顶部的EditText,调用这个,top_edittext_bg

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"    android:shape="rectangle" >    <solid        android:color="#e2e2e2" >    </solid>    <corners        android:radius="1dp"        android:bottomLeftRadius="0.1dp"        android:bottomRightRadius="0.1dp"        android:topLeftRadius="5dp"        android:topRightRadius="5dp" >    </corners></shape>


对于中间的EditText,调用这个,bottom_edittext_bg

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"    android:shape="rectangle" >    <solid        android:color="#e2e2e2" >    </solid>    <corners        android:radius="1dp"        android:bottomLeftRadius="5dp"        android:bottomRightRadius="5dp"        android:topLeftRadius="0.1dp"        android:topRightRadius="0.1dp" >    </corners></shape>

然后设置这个在android:background="@drawable/RESPECTIVE_XMLS"属性给相关联的EditText's

更多相关文章

  1. Android语音便签快速调用-内置录音程序
  2. Android应用程序核心-应用程序的基本组件
  3. android 使用Intent传递数据之全局变量传递
  4. Android(安卓)activity 详解一:activity的生命周期
  5. Android的MediaPlayer架构介绍
  6. Android(安卓)中webview与原生Java的 交互以及网页JS 与原生的交
  7. Android(安卓)init.rc文件解析过程分析
  8. Webview实现Android和JS通信
  9. 【转】Android(安卓)技术-- 图形系统详解

随机推荐

  1. SearchView使用
  2. Android利用AChartEngine绘制图表
  3. Android(安卓)使用 Android(安卓)Camera
  4. Android(安卓)ListView组件 ArrayAdapter
  5. Android实现一行有好几个TextView 第一个
  6. Android四种常用的消息传递机制/模式的比
  7. 网易云短信android接入
  8. eclipse 上使用recycleview,cardview的办
  9. AndroidManifest.xml 文件里面的内容介绍
  10. (转载) Android(安卓)RecyclerView 使用完