我的代码:
final EditText input = new EditText(VideoRunActivity.this);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
input.setLayoutParams(lp);
input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
显示我输入的输入。提前谢谢。
答案 0 :(得分:1)
尝试这样做:
input.setTransformationMethod(PasswordTransformationMethod.getInstance());
所以代码就是这样:
final EditText input = new EditText(VideoRunActivity.this);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
input.setLayoutParams(lp);
input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
input.setTransformationMethod(PasswordTransformationMethod.getInstance());
答案 1 :(得分:0)
在XML
:
<EditText
android:id="@+id/txtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword" >
</EditText>
答案 2 :(得分:0)
试试这个
input.setTransformationMethod(new PasswordTransformationMethod());