<EditText android:id="@+id/second_password" android:layout_width="match_parent" android:layout_height="wrap_content" android:digits="1234567890" android:maxLength="6" android:paddingLeft="@dimen/dp_20" android:singleLine="true" android:textSize="@dimen/sp_14"/>
secondPassword.setInputType(EditorInfo.TYPE_CLASS_PHONE);//数字键盘 secondPassword.setTransformationMethod(new PasswordTransformationMethod());//密文
android:inputType=”none” android:inputType=”text” android:inputType=”textCapCharacters” 字母大写 android:inputType=”textCapWords” 首字母大写 android:inputType=”textCapSentences” 仅第一个字母大写 android:inputType=”textAutoCorrect” 自动完成 android:inputType=”textAutoComplete” 自动完成 android:inputType=”textMultiLine” 多行输入 android:inputType=”textImeMultiLine” 输入法多行(如果支持) android:inputType=”textNoSuggestions” 不提示 android:inputType=”textUri” 网址 android:inputType=”textEmailAddress” 电子邮件地址 android:inputType=”textEmailSubject” 邮件主题 android:inputType=”textShortMessage” 短讯 android:inputType=”textLongMessage” 长信息 android:inputType=”textPersonName” 人名 android:inputType=”textPostalAddress” 地址 android:inputType=”textPassword” 密码 android:inputType=”textVisiblePassword” 可见密码 android:inputType=”textWebEditText” 作为网页表单的文本 android:inputType=”textFilter” 文本筛选过滤 android:inputType=”textPhonetic” 拼音输入 //数值类型 android:inputType=”number” 数字 android:inputType=”numberSigned” 带符号数字格式 android:inputType=”numberDecimal” 带小数点的浮点格式 android:inputType=”phone” 拨号键盘 android:inputType=”datetime” 时间日期 android:inputType=”date” 日期键盘 android:inputType=”time” 时间键盘
<activity android:name=".Main"
android:label="@string/app_name"
android:windowSoftInputMode="adjustUnspecified|stateHidden"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
EditText edit=(EditText)findViewById(R.id.edit); edit.clearFocus();
EditText edit=(EditText)findViewById(R.id.edit); InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edit.getWindowToken(),0);
class InputLowerToUpper extends ReplacementTransformationMethod{
@Override
protected char[] getOriginal() {
char[] lower = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
return lower;
}
@Override
protected char[] getReplacement() {
char[] upper = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
return upper;
}
}
editText.setTransformationMethod(new InputLowerToUpper());
//下面这种方法才是真正的将输入的小写字母转换为大写字母
addressText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
addressText.removeTextChangedListener(this);//解除文字改变事件
addressText.setText(s.toString().toUpperCase());//转换
addressText.setSelection(s.toString().length());//重新设置光标位置
addressText.addTextChangedListener(this);//重新绑
// licensePlateNumber = addressText.getText().toString().trim();
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
}
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有