不可编辑可点击:设置两个属性即可

mEdittext.setFocusable(false);
mEdittext.setOnClickListener(this::onClick);

输入密码可见与不可见

private boolean ifonpenteyes=true;
if (ifonpenteyes){
    ifshowpawimage.setImageResource(R.mipmap.openeyes);
    login_pasw.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    login_pasw.setSelection(login_pasw.getText().length());
    ifonpenteyes = !ifonpenteyes;
}else {
    ifshowpawimage.setImageResource(R.mipmap.closeeyes);
    login_pasw.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD| InputType.TYPE_CLASS_TEXT);
    login_pasw.setSelection(login_pasw.getText().length());
    ifonpenteyes = !ifonpenteyes;
}
xml文件

<EditText
    android:id="@+id/login_pasw"
    android:layout_width="0dp"
    android:layout_weight="5"
    android:layout_height="20dp"
    android:layout_marginLeft="6dp"
    android:background="@null"
    android:gravity="center_vertical"
    android:hint="@string/mm"
    android:imeOptions="actionNext"
    android:inputType="textPassword"
    android:maxLines="1"
    android:singleLine="true"
    android:digits="@string/pwd_limit"
    android:textColor="@color/text_color_dark_black"
    android:textColorHint="@color/text_color_cdcdcd"
    android:textCursorDrawable="@drawable/editcolor"
    android:textSize="16sp" />

效果:

3、输入验证码,密码换个输入实现

适配依赖

implementation 'com.github.licheedev.CommonSize:common_size_w750_n1000:1.3'

布局文件

<RelativeLayoutandroid:layout_width="@dimen/normal_605dp"android:layout_height="@dimen/normal_100dp"android:layout_marginTop="@dimen/normal_550dp"><LinearLayoutandroid:layout_width="@dimen/normal_605dp"android:layout_height="@dimen/normal_100dp"android:background="@drawable/bg_ed_5dp"android:gravity="center_vertical"><TextViewandroid:id="@+id/ed1"android:layout_width="@dimen/normal_100dp"android:layout_height="@dimen/normal_100dp"android:gravity="center"android:inputType="textPassword"android:textColor="@color/color_333"android:textSize="@dimen/normal_32dp" /><Viewandroid:layout_width="@dimen/normal_1dp"android:layout_height="@dimen/normal_80dp"android:background="@color/color_EF611E"/><TextViewandroid:id="@+id/ed2"android:layout_width="@dimen/normal_100dp"android:layout_height="@dimen/normal_100dp"android:textSize="@dimen/normal_32dp"android:textColor="@color/color_333"android:gravity="center"/><Viewandroid:layout_width="@dimen/normal_1dp"android:layout_height="@dimen/normal_80dp"android:background="@color/color_EF611E"/><TextViewandroid:id="@+id/ed3"android:layout_width="@dimen/normal_100dp"android:layout_height="@dimen/normal_100dp"android:textSize="@dimen/normal_32dp"android:textColor="@color/color_333"android:inputType="textPassword"android:gravity="center"/><Viewandroid:layout_width="@dimen/normal_1dp"android:layout_height="@dimen/normal_80dp"android:background="@color/color_EF611E"/><TextViewandroid:id="@+id/ed4"android:layout_width="@dimen/normal_100dp"android:layout_height="@dimen/normal_100dp"android:textSize="@dimen/normal_32dp"android:textColor="@color/color_333"android:inputType="textPassword"android:gravity="center"/><Viewandroid:layout_width="@dimen/normal_1dp"android:layout_height="@dimen/normal_80dp"android:background="@color/color_EF611E"/><TextViewandroid:id="@+id/ed5"android:layout_width="@dimen/normal_100dp"android:layout_height="@dimen/normal_100dp"android:textSize="@dimen/normal_32dp"android:textColor="@color/color_333"android:inputType="textPassword"android:gravity="center"/><Viewandroid:layout_width="@dimen/normal_1dp"android:layout_height="@dimen/normal_80dp"android:background="@color/color_EF611E"/><TextViewandroid:id="@+id/ed6"android:layout_width="@dimen/normal_100dp"android:layout_height="@dimen/normal_100dp"android:textSize="@dimen/normal_32dp"android:textColor="@color/color_333"android:inputType="textPassword"android:gravity="center"/></LinearLayout><EditTextandroid:id="@+id/edEnter"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@color/transparent"android:textColor="@color/transparent"android:inputType="numberPassword"android:cursorVisible="false"android:maxLength="6"/></RelativeLayout>

实现代码

@BindView(R.id.ed1)
TextView mEd1;
@BindView(R.id.ed2)
TextView mEd2;
@BindView(R.id.ed3)
TextView mEd3;
@BindView(R.id.ed4)
TextView mEd4;
@BindView(R.id.ed5)
TextView mEd5;
@BindView(R.id.ed6)
TextView mEd6;
@BindView(R.id.edEnter)
EditText mEdEnter;
ButterKnife.bind(this);edTexts = new ArrayList<>(Arrays.asList(mEd1, mEd2, mEd3, mEd4, mEd5, mEd6));mEdEnter.addTextChangedListener(new TextWatcher() {@Overridepublic void beforeTextChanged(CharSequence s, int i, int i1, int i2) {}@Overridepublic void onTextChanged(CharSequence s, int i, int i1, int i2) {//toast("您输入的数据为:" + s.toString());}@Overridepublic void afterTextChanged(Editable editable) {String s = mEdEnter.getText().toString();char[] chars = s.toCharArray();for (TextView edText : edTexts) {edText.setText("");}for (int i = 0; i < chars.length; i++) {edTexts.get(i).setText(chars[i]+"");}}
});

资源

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"><stroke android:width="@dimen/normal_1dp" android:color="@color/color_EF611E"/><corners android:radius="@dimen/normal_5dp"/></shape>
<color name="color_EF611E">#EF611E</color><color name="color_333">#333333</color>

实现效果——换格输入框

车牌号自定义输入实现demo

自定义键盘

demo链接: https://download.csdn.net/download/meixi_android/16635556

这些bug交流:QQ1085220040

Edittext不可编辑可点击,输入密码可见与不可见,验证码换格输入实现方法,车牌号自定义输入键盘相关推荐

  1. android edittext 不可编辑

    今天,简单讲讲如何让  edittext 不可编辑. 这个很简单,不过之前忘记了,还是查找了部分资料,所以这里记录一下. 1.android:editable="false" ...

  2. Android编辑框不能输入汉字,Android编程中EditText限制文字输入的方法

    本文实例讲述了Android编程中EditText限制文字输入的方法.分享给大家供大家参考,具体如下: Android的编辑框控件EditText在平常编程时会经常用到,有时候会对编辑框增加某些限制, ...

  3. 在jsp页面中点击编辑按钮,显示input边框,可编辑,点击保存按钮,输入框消失,不可编辑,并将文本框中的内容保存到数据库中

    寻找的资料 一. 默认readonly不允许编辑.点击编辑的时候加上边框样式,去掉readonly属性 <style>.readonly input{border:none}</st ...

  4. 在vue中,Echarts雷达图中indicator的点击事件,不能改变data中的值的解决方法

    在vue中,Echarts雷达图中indicator的点击事件,不能改变data中的值的解决方法 参考文章: (1)在vue中,Echarts雷达图中indicator的点击事件,不能改变data中的 ...

  5. 解决默写浏览器中点击input输入框时,placeholder的值不消失的方法

    解决默写浏览器中点击input输入框时,placeholder的值不消失的方法 参考文章: (1)解决默写浏览器中点击input输入框时,placeholder的值不消失的方法 (2)https:// ...

  6. win10尘埃4点击开始游戏自动关闭没反应|dirt4.exe进程消失的解决方法

    win10尘埃4点击开始游戏自动关闭该怎么办?在win10系统中运行尘埃4的用户反应在打开游戏点击 [开始游戏]后没有任何反应的现象,在任务管理器中还能看到dirt4.exe进程,但是过一会就自动消失 ...

  7. php点击弹遮罩层,小程序:防止点击遮罩层后遮罩层下面也反应的解决方法

    本篇文章给大家带来的内容是关于小程序:防止点击遮罩层后遮罩层下面也反应的解决方法,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 最近在做自定义弹窗,不免会使用到遮罩层或者说蒙层. 但 ...

  8. android 输入法不自动弹出窗口,Android EditText默认不弹出输入法的实现方法

    一.Android EditText默认不弹出输入法的办法: 1. 在AndroidManifest.xml中将需要默认隐藏键盘的Activity中添加属性即可(常用此方法) android:wind ...

  9. android 键盘搜索按钮不收起键盘,android EditText 实现搜索框点击搜索隐藏键盘

    布局: android:id="@+id/search_input" android:background="#00000000" android:layout ...

最新文章

  1. 面试----Object类
  2. python字典get计数_python字典中的get方法与setdefault方法
  3. android 消息循环机制--looper handler
  4. atoi() 与 itoa()函数的内部实现
  5. 求极大子矩阵的两种方法
  6. Python冒泡排序(4)
  7. 高可用Redis服务架构分析与搭建
  8. 如何把密度函数化为标准正态二维分布_概率微课:第三章(22) 二维随机变量及分布函数定义...
  9. 前端 如何检测到当前的网页已经退出_javascript在当前窗口关闭前检测窗口是否关闭...
  10. VS的一个项目,release/debug/x64/win32的设置有没有办法一次设置?
  11. python正则表达式模块re
  12. 腾讯云TBase分布式数据库安装部署
  13. <<计算机视觉CVPR>>2022:Grounded Language-Image Pre-training
  14. 技.艺.道:器-python一站式平台Jupyter(丘比特)入门
  15. IIS 启动不了(发生意外错误0x8ffe2740)
  16. linux下利用MP4v2封装H264 aac为mp4
  17. 快速学习-cmd命令大全
  18. Excel - 表格设置数字下拉数值不变不递增
  19. 入门推荐系统,你不应该错过的知识清单
  20. 5. PHP 输出图像 imagegif 、imagejpeg 与 imagepng 函数

热门文章

  1. 工作63:await和anync
  2. “约见”面试官系列之常见面试题第二十三篇之get和post区别(建议收藏)
  3. 前端学习(2022)vue之电商管理系统电商系统之创建order分支
  4. 前端学习(2012)vue之电商管理系统电商系统之手动为upload组件添加请求头
  5. 前端学习(1847)vue之电商管理系统电商系统的功能划分
  6. 前端学习(82):按内容进行分类
  7. 玩转oracle 11g(47):oracle删除非空表空间
  8. java学习(139):多个catch块
  9. 玩转oracle 11g(25):手工删除oracle归档日志后操作步骤 和修改用户默认解锁时间
  10. Python3 isspace()方法