EditText圆角 Android中实现EditText圆角的方法

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

EditText圆角 Android中实现EditText圆角的方法

  2021-03-18 我要评论
想了解Android中实现EditText圆角的方法的相关内容吗,在本文为您仔细讲解EditText圆角的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:EditText,圆角,下面大家一起来学习吧。

一、在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"/>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们