美文网首页
EditText设置InputType

EditText设置InputType

作者: 尔乐 | 来源:发表于2017-02-21 20:05 被阅读292次

xml 设置

<EditText
        android:inputType="textPassword"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

code 设置

EditText pwd = new EditText(context);
pwd.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD);

注意必须加上对应的TYPE_CLASS_XXX,如:InputType.TYPE_CLASS_TEXT,InputType.TYPE_CLASS_NUMBER等

相关文章

网友评论

      本文标题:EditText设置InputType

      本文链接:https://www.haomeiwen.com/subject/tzguwttx.html