简体   繁体   中英

how can i set android inputType as textPassword

I have a dialog box that i have created. this is the code for edittext box. but i want the text to be like password textbox. what change can i do?

android:inputType="textPassword"   


final EditText input = new EditText(Setting.this);
                LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                                        LinearLayout.LayoutParams.MATCH_PARENT,
                                        LinearLayout.LayoutParams.MATCH_PARENT);
                  input.setLayoutParams(lp);

May be this

EditText dt = new EditText(this);
dt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

Set inputType for an EditText?

input.setInputType(InputType.TYPE_CLASS_TEXT | inputType.TYPE_TEXT_VARIATION_PASSWORD);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM