我想在EditText中输入一个十六进制数字。如何设置keyListener以限制输入值?
谢谢!
答案 0 :(得分:1)
在EditText xml中使用android:inputType="number"
您还可以添加文字观察器editText.addTextChangedListener (new MyTextWatcher ());
private class MyTextWatcher implements TextWatcher {
@Override
public void beforeTextChanged (CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged (CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged (Editable s) {
}
}