---
title: "Android正确创建密码输入框"
author: "zeroblue"
date: "2011-04-12T15:04:09Z"
tags: []
categories: ["移动开发"]
slug: "android"
draft: false
lastmod: "2011-04-12T15:04:09Z"
id: 999000
url: "https://zeroblue.iteye.com/blog/999000"
---

XML：

```java


inputType="textPassword"


```


in code:

```java


new EditText(context).setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);


```