一、在drawable下面添加xml文件rounded_editview.xml 代码如下:<?xml version="1.0" encoding="utf-8"?&
一、在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"/>
--结束END--
本文标题: Android中实现EditText圆角的方法
本文链接: https://www.lsjlt.com/news/27900.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0