<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#FFFFFF"/>
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:background="@drawable/rounded_edittext" />
</LinearLayout>
你也可以设置不同的编辑状态
<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext_states.xml -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:state_enabled="true"
android:drawable="@drawable/rounded_focused" />
<item
android:state_focused="true"
android:state_enabled="true"
android:drawable="@drawable/rounded_focused" />
<item
android:state_enabled="true"
android:drawable="@drawable/rounded_edittext" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext_focused.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#FFFFFF"/>
<stroke android:width="2dp" android:color="#FF0000" />
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:background="@drawable/rounded_edittext_states"
android:padding="5dip"/>
</LinearLayout>
分享到:
相关推荐
Android中实现EditText圆角的方法,需要的朋友可以参考一下
editText和Dialog等组件的圆角边框设置
Android Studio 在xml文件中设置界面布局1、xml文件中给输入框editText修改下划线颜色2、设置button按钮为圆角及修改按钮颜色3、运用约束布局时预览效果和运行效果不一致 写一写今天困扰我很久的问题:如何给...
android中设置EditText有四周边框,圆角边框。将此文件放到res/drawable/edittext.xml,在布局文件中给EditText添加属性android:background="@drawable/edittext"。效果完美实现。当然,里面的圆角,颜色可根据自己...
带删除按钮的圆角EditText
NULL 博文链接:https://wen742538485.iteye.com/blog/1560745
实现了: 1.圆角listview 2.带删除图标的EditText 3.带下划画的EditText 4.用shape设置EditText的圆角边框
EditText被圆角矩形边框包围。 每当编辑文本获得焦点时,AwesomeTextInputLayout就会受到Google Contact App的Add New Contact屏幕中EditText字段的启发而产生的EditText装饰器。 EditText被圆角矩形边框包围。 只要...
本源码实例是基于mpandroidchart包(已嵌入),实现多EditText框体实时录入数据至柱状统计图中,不只是一张统计图,而且在源码中详细注释各种变量;统计图X,Y轴长短均可自定义改变;按钮自带声音;EditText框体未...
RichEditor基于原生EditText + span实现的Android富文本编辑器组件描述该组件是基于原生EditText + span的方式实现的,逐步提供一个功能齐全且使用方便的Android富文本编辑器。主要支持了加粗斜体等行内样式,标题...
EditText backgrounds">Bootstrap 使用Font Awesome图标字体文件 集成了圆角按钮 禁用状态按钮 自定义按钮尺寸 可设定按钮动画 旋转和闪烁动画 ps:字体文件在asset里面 说的不是很明白 看下面英文解释吧 ...
1.如何使用圆角输入框和按钮背景 2.如何实现“手机号”、“密码”后面的竖线 3.如何嵌套输入框的布局 4.如何监听输入框的输入事件及删除按钮的动态显示隐藏 1.如何使用圆角输入框和按钮背景 安卓为开发者准备了...