XEditText文本输入框的使用

主要功能

1,带删除功能的EditText;
2,显示或者隐藏密码;
3,可设置自动添加分隔符分割电话号码、银行卡号等;
4,支持禁止Emoji表情符号输入

添加依赖

compile 'com.xw.repo:xedittext:2.1.0@aar'

布局文件中

<com.xw.repo.XEditText
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:hint="default, just likes EditText"
      app:x_disableClear="true"/>

 <com.xw.repo.XEditText
            android:id="@+id/clear_marker_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="default password input"
            android:inputType="textPassword"
            android:maxLength="30"/>

  <com.xw.repo.XEditText
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:hint="default password input"
      android:inputType="textPassword"/>

  <com.xw.repo.XEditText
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:hint="pwd input, custom drawables"
      android:inputType="textPassword" <!-- don't set gravity to center, center_horizontal, right or end, otherwise the ClearDrawable will not appear. -->
      app:x_clearDrawable="@mipmap/ic_clear" <!--support vector drawable-->
      app:x_hidePwdDrawable="@mipmap/ic_hide" <!--support vector drawable-->
      app:x_showPwdDrawable="@mipmap/ic_show"/> <!--support vector drawable-->

  <com.xw.repo.XEditText
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:hint="the pattern to separate the content"
      app:x_pattern="3,4,4"
      app:x_separator=" "/>
      
<com.xw.repo.XEditText
            android:id="@+id/custom_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="customize separating pattern"
            android:inputType="phone"
            app:x_separator="-"/>
        <!-- if you want to separate, do not set maxLength attr -->

<com.xw.repo.XEditText
            android:id="@+id/enable_emoji_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"
            android:hint="enable emoji inputting"
            app:x_disableEmoji="false"/>

        <com.xw.repo.XEditText
            android:id="@+id/disable_emoji_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="disable emoji inputting"
            app:x_disableEmoji="true"/>

代码中设置分隔:

showXEdit.setSeparator(" ");
showXEdit.setPattern(new int[]{3, 4, 4});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

智玲君

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值