我正在以编程方式实现EditText,代码就像这样
private View createTextField(String schemaName, LinearLayout.LayoutParams params2, String fieldMaxLength) {
final EditText editText = new EditText(mContext);
//editText.setHint(field.getDisplayName());
// set the layoutParams on the button
editText.setLayoutParams(params2);
editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, editTextSize);
editText.setTypeface(Typeface.create("sans-serif-bold", Typeface.NORMAL));
editText.setTextColor(getResources().getColor(R.color.edit_text_color));
if (schemaName.equals("Notes")) {
editText.setMaxLines(10);
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
} else {
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
}
if (fieldMaxLength != null) {
try {
int maxLength = Integer.parseInt(fieldMaxLength);
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
} catch (NumberFormatException nfe) {
}
}
return editText;
}
长按我得到复制,剪切和粘贴的选项,但它们都没有工作。
[
请帮助我,我做错了什么?