本文整理了Java中android.text.method.DigitsKeyListener.()
方法的一些代码示例,展示了DigitsKeyListener.()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DigitsKeyListener.()
方法的具体详情如下:
包路径:android.text.method.DigitsKeyListener
类名称:DigitsKeyListener
方法名:
DigitsKeyListener.介绍
暂无
代码示例
代码示例来源:origin: stackoverflow.com
EditText editView = new EditText(this);
editView.setKeyListener(new DigitsKeyListener());
代码示例来源:origin: stackoverflow.com
numericField.setInputType(Configuration.KEYBOARD_12KEY);
numericField.setKeyListener(new DigitsKeyListener());
代码示例来源:origin: stackoverflow.com
DigitsKeyListener MyDigitKeyListener = new DigitsKeyListener(true, true);
editEntryView.setKeyListener( MyDigitKeyListener );
代码示例来源:origin: stackoverflow.com
editText.setKeyListener(new DigitsKeyListener(true, true));
代码示例来源:origin: stackoverflow.com
tv = (EditText) findViewById(R.id.tv);
cb = (CheckBox) findViewById(R.id.cb);
tv.setKeyListener(null);
tv.setEnabled(false);
cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked) {
tv.setEnabled(true);
tv.setKeyListener(new DigitsKeyListener(false, true));
} else {
tv.setEnabled(false);
tv.setKeyListener(null);
}
}
});
代码示例来源:origin: stackoverflow.com
EditText editView = new EditText(this);
editView.setKeyListener(new NumberKeyListener())
EditText editView = new EditText(this);
editView.setKeyListener(new DigitsKeyListener());
代码示例来源:origin: aldoKelvianto/AutoFormatEditText
private void setSoftInputKeyboard() {
setKeyListener(new DigitsKeyListener(false, isDecimal));
}
代码示例来源:origin: stackoverflow.com
EditText editView = new EditText(this);
editView.setKeyListener(new DigitsKeyListener());
代码示例来源:origin: GeoODK/collect
public ExIntegerWidget(Context context, FormEntryPrompt prompt) {
super(context, prompt);
mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED);
// only allows numbers and no periods
mAnswer.setKeyListener(new DigitsKeyListener(true, false));
// ints can only hold 2,147,483,648. we allow 999,999,999
InputFilter[] fa = new InputFilter[1];
fa[0] = new InputFilter.LengthFilter(9);
mAnswer.setFilters(fa);
Integer i = getIntegerAnswerValue();
if (i != null) {
mAnswer.setText(i.toString());
}
}
代码示例来源:origin: GeoODK/collect
public ExDecimalWidget(Context context, FormEntryPrompt prompt) {
super(context, prompt);
mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
// only allows numbers and no periods
mAnswer.setKeyListener(new DigitsKeyListener(true, true));
// only 15 characters allowed
InputFilter[] fa = new InputFilter[1];
fa[0] = new InputFilter.LengthFilter(15);
mAnswer.setFilters(fa);
Double d = getDoubleAnswerValue();
// apparently an attempt at rounding to no more than 15 digit precision???
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(15);
nf.setMaximumIntegerDigits(15);
nf.setGroupingUsed(false);
if (d != null) {
// truncate to 15 digits max...
String dString = nf.format(d);
d = Double.parseDouble(dString.replace(',', '.')); // in case , is decimal pt
mAnswer.setText(d.toString());
}
}
代码示例来源:origin: stackoverflow.com
text.setKeyListener(new DigitsKeyListener());
代码示例来源:origin: Jmengfei/AddSubUtils
private void setEditable(boolean editable) {
if (editable) {
etInput.setFocusable(true);
etInput.setKeyListener(new DigitsKeyListener());
} else {
etInput.setFocusable(false);
etInput.setKeyListener(null);
}
}
代码示例来源:origin: NewHuLe/NumberPickerView
/**
* @param editable 设置输入框是否可编辑
*/
private void setEditable(boolean editable) {
if (editable) {
mNumText.setFocusable(true);
mNumText.setKeyListener(new DigitsKeyListener());
} else {
mNumText.setFocusable(false);
mNumText.setKeyListener(null);
}
}
代码示例来源:origin: GeoODK/collect
mAnswer.setKeyListener(new DigitsKeyListener(true, true));
代码示例来源:origin: org.metawidget.modules/metawidget-all
editText.setKeyListener( new DigitsKeyListener() );
editText.setKeyListener( new DigitsKeyListener() );
代码示例来源:origin: GeoODK/collect
public IntegerWidget(Context context, FormEntryPrompt prompt, boolean readOnlyOverride) {
super(context, prompt, readOnlyOverride, true);
mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize);
mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED);
// needed to make long readonly text scroll
mAnswer.setHorizontallyScrolling(false);
mAnswer.setSingleLine(false);
// only allows numbers and no periods
mAnswer.setKeyListener(new DigitsKeyListener(true, false));
// ints can only hold 2,147,483,648. we allow 999,999,999
InputFilter[] fa = new InputFilter[1];
fa[0] = new InputFilter.LengthFilter(9);
mAnswer.setFilters(fa);
if (prompt.isReadOnly()) {
setBackgroundDrawable(null);
setFocusable(false);
setClickable(false);
}
Integer i = getIntegerAnswerValue();
if (i != null) {
mAnswer.setText(i.toString());
}
setupChangeListener();
}
代码示例来源:origin: oliexdev/openScale
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.graph_preferences);
EditTextPreference regressiOnLineOrder=
(EditTextPreference) findPreference(PREFERENCE_KEY_REGRESSION_LINE_ORDER);
regressionLineOrder.getEditText().setKeyListener(new DigitsKeyListener());
regressionLineOrder.getEditText().setSelectAllOnFocus(true);
regressionLineOrder.setSummary(regressionLineOrder.getText());
regressionLineOrder.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
preference.setSummary((String) newValue);
return true;
}
});
}
}