Android中实现EditText圆角的方法

时间:2023-10-11 20:53:52 

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

标签:EditText,圆角
0
投稿

猜你喜欢

  • Android Retrofit原理深入探索

    2023-09-06 02:47:15
  • c# 空合并运算符“??”的使用详解

    2022-11-23 13:47:36
  • ArrayList和LinkedList的区别、扩容机制以及底层的实现方式

    2023-11-27 01:26:57
  • Springboot和bootstrap实现shiro权限控制配置过程

    2022-01-19 21:31:23
  • 深入分析JAVA流程控制语句

    2023-11-20 10:48:32
  • Unity常用命令模式详解

    2021-12-30 16:58:08
  • C# 根据表格偶数、奇数加载不同颜色

    2022-01-19 11:46:05
  • Android应用程序的编译流程及使用Ant编译项目的攻略

    2022-09-18 18:22:16
  • Android使用Intent显示实现页面跳转

    2023-04-16 12:02:21
  • Java中重载与重写的对比与区别

    2021-08-29 13:22:31
  • 用C# 实现鼠标框选效果的实现代码

    2023-04-18 14:08:26
  • C#控件picturebox实现图像拖拽和缩放

    2023-08-09 08:23:05
  • android照相、相册获取图片剪裁报错的解决方法

    2021-11-21 20:18:14
  • opencv检测直线方法之投影法

    2023-08-28 04:43:15
  • mybatis教程之resultmap_动力节点Java学院整理

    2022-09-05 22:38:37
  • Android开发中使用sqlite实现新闻收藏和取消收藏的功能

    2023-01-27 18:15:13
  • JAVA内部类示例详解及练习

    2023-04-05 06:42:39
  • Java流程控制语句最全汇总(上篇)

    2023-11-03 01:57:48
  • Jenkins自动化打包为war包

    2021-08-08 20:25:49
  • SpringBoot之Controller的使用详解

    2023-02-16 21:18:30
  • asp之家 软件编程 m.aspxhome.com