Android中实现EditText圆角的方法
Android中实现EditText圆角的方法
发布时间:2016-12-28 来源:查字典编辑
摘要:一、在drawable下面添加xml文件rounded_editview.xml复制代码代码如下:二、在EditText的backgroun...

一、在drawable下面添加xml文件rounded_editview.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"></solid>

<padding android:left="10dp"

android:top="10dp"

android:right="10dp"

android:bottom="10dp"></padding>

<corners android:radius="15dp"></corners>

</shape>

二、在EditText的background属性中引用这个xml

复制代码 代码如下:

<EditText

android:id="@+id/et_username"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:inputType="text"

android:background="@drawable/rounded_editview"

android:hint="@string/text_hint_username"/>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新安卓软件开发学习
热门安卓软件开发学习
编程开发子分类