我需要一个编辑文本验证,它只允许数字和: symbol.and 长度不应超过 5 个字符。而且大多数我正在务实地创建这个 edittext
final EditText timeVisited = new EditText(this);
timeVisited.setId(20);
timeVisited.setText(Tm);
timeVisited.setTextColor(Color.BLACK);
timeVisited.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
timeVisited.setHint("eg. 14:30");
timeVisited.setPadding(5,5,5,5);
timeVisited.setSingleLine(false);
timeVisited.setLines(1);
timeVisited.setBackgroundResource(R.drawable.text_bg);
customerToCatchTblRow.addView(timeVisited);// add the column to the table row here
LinearLayout.LayoutParams params5 = (LinearLayout.LayoutParams)timeVisited.getLayoutParams();
params5.setMargins(0, 0, 5, 0); //substitute parameters for left, top, right, bottom
timeVisited.setLayoutParams(params5);