密码单线如何 [英] Password singleline how to

查看:102
本文介绍了密码单线如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编程设置的EditText ,显示一个类似密码文本,我也需要这个的EditText 是单行

I need to programatically set EditText to display text like password and I also need this EditText to be single line.

我知道如何使的EditText ,显示一个类似密码文本:

I know how to make EditText to display text like password:

editText.setTransformationMethod(PasswordTransformationMethod.getInstance());

我也知道如何展示的EditText 上一行:

editText.setEllipsize(TruncateAt.END);
editText.setSingleLine();

我不知道如何将这两个结合起来。当我把code的这些线在一起,在的EditText 不工作。甚至软件键盘不能显示它。

I don't know how to combine these two. When I put these lines of code together, the EditText is not working. Even the software keyboard can't be displayed for it.

你们的有谁知道如何解决我的问题呢?预先感谢你的答案(S)。

Does anyone of you guys know how to solve my problem? Thanks in advance for your answer(s).

推荐答案

我终于做到了。对于那些谁也有同样问题的正确方法是将两个要求结合起来,但在不同的顺序,比我以前做过。所以,你应该做的:

I finally did it. For those who have the same problem the correct approach is to combine the two requests but in the different order than I did it before. So you should do:

editText.setEllipsize(TruncateAt.END);
editText.setSingleLine();
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());

我希望这会帮助别人。

I hope this will help someone.

这篇关于密码单线如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆