在android中创建圆角的文本框的实现
16lz
2021-01-23
在很多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
更多相关文章
- Android 应用程序中使用 Internet 数据(XML、JSON 和 protocol bu
- PHP开发Android应用程序
- Android应用程序核心-应用程序的基本组件
- Android 应用程序中-设置-蓝牙,若隐藏蓝牙功能
- Android应用程序四大组件
- Android初学习 - android:sharedUserId="android.uid.system" 应
- Android 应用程序构成
- [入门八]Android的应用程序框架