Android实现EditText 是否显示密码

本文分享了一套系统化的学习资料,包括2021年的上万页大厂面试真题、NDK模块开发、Android框架体系架构等内容,强调有组织的学习对于快速提升技术的重要性。
摘要由CSDN通过智能技术生成
  • 27

  • 28

  • 29

  • 30

  • 31

  • 32

  • 33

  • 34

  • 35

  • 36

  • 37

  • 38

  • 39

  • 40

  • 41

  • 42

  • 43

  • 44

  • 45

  • 46

  • 47

  • 48

  • 49

  • 50

  • 51

  • 52

  • 53

  • 54

  • 55

  • 56

  • 57

  • 58

  • 59

  • 60

  • 61

  • 62

  • 63

  • 64

  • 65

  • 66

  • 67

  • 68

  • 69

  • 70

  • 71

  • 72

  • 73

  • 74

  • 75

  • 76

  • 77

2.代码实现


public class MainActivity extends AppCompatActivity { private PopupWindow popupWindow; private View popupView; private EditText etPayPwd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnWithdraw = (Button) findViewById(R.id.btnWithdraw); btnWithdraw.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showPayPwdDialog(); BrightnessManager.lightOff(MainActivity.this); } }); } private void showPayPwdDialog() { if (popupWindow == null) { popupView = View.inflate(MainActivity.this, R.layout.popupwindow_pay_pwd, null); popupWindow = new PopupWindow(popupView, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { BrightnessManager.lightOn(MainActivity.this); etPayPwd.setText(""); } }); popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); ToggleButton togglePwd = (ToggleButton) popupView.findViewById(R.id.togglePwd); etPayPwd = (EditText) popupView.findViewById(R.id.etPayPwd); togglePwd.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { //如果选中,显示密码 etPayPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); } else { //否则隐藏密码 etPayPwd.setTransformationMethod(PasswordTransformationMethod.getInstance()); } } }); popupView.findViewById(R.id.tvCancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { popupWindow.dismiss(); BrightnessManager.lightOn(MainActivity.this); } }); popupView.findViewById(R.id.tvConfirm).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String payPwd = etPayPwd.getText().toString(); popupWindow.dismiss(); BrightnessManager.lightOn(MainActivity.this); if (!TextUtils.isEmpty(payPwd)) { Toast.makeText(MainActivity.this, "提现请求提交成功!", Toast.LENGTH_SHORT).show(); } } }); } if (popupWindow.isShowing()) { popupWindow.dismiss(); BrightnessManager.lightOn(MainActivity.this); } popupWindow.showAtLocation(MainActivity.this.findViewById(R.id.activity_main), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); } }

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

  • 11

  • 12

  • 13

  • 14

  • 15

  • 16

  • 17

  • 18

  • 19

  • 20

  • 21

  • 22

  • 23

  • 24

  • 25

  • 26

  • 27

  • 28

  • 29

  • 30

  • 31

  • 32

  • 33

  • 34

  • 35

  • 36

  • 37

  • 38

  • 39

  • 40

  • 41

  • 42

  • 43

  • 44

  • 45

  • 46

  • 47

  • 48

  • 49

  • 50

  • 51

  • 52

  • 53

  • 54

  • 55

  • 56

  • 57

  • 58

  • 59

  • 60

  • 61

  • 62

  • 63

  • 64

  • 65

  • 66

  • 67

学习分享

在当下这个信息共享的时代,很多资源都可以在网络上找到,只取决于你愿不愿意找或是找的方法对不对了

很多朋友不是没有资料,大多都是有几十上百个G,但是杂乱无章,不知道怎么看从哪看起,甚至是看后就忘

如果大家觉得自己在网上找的资料非常杂乱、不成体系的话,我也分享一套给大家,比较系统,我平常自己也会经常研读。

2021最新上万页的大厂面试真题

image

七大模块学习资料:如NDK模块开发、Android框架体系架构…

image

2021大厂面试真题:

image

只有系统,有方向的学习,才能在短时间内迅速提高自己的技术,只有不断地学习,不懈的努力才能拥有更好的技术,才能在互联网行业中立于不败之地。
《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》点击传送门,即可获取!
系架构…**

[外链图片转存中…(img-VKWVWYGE-1714505107134)]

2021大厂面试真题:

[外链图片转存中…(img-7oU81zp8-1714505107135)]

只有系统,有方向的学习,才能在短时间内迅速提高自己的技术,只有不断地学习,不懈的努力才能拥有更好的技术,才能在互联网行业中立于不败之地。
《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》点击传送门,即可获取!

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值