下面列出了android.widget.EditText#getId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void onError(EditText v, int errorCode, String errorMsg) {
X8ToastUtil.showToast(this.mContext, this.contentView.getContext().getString(R.string.x8_fc_exp_error_tip), 0);
double curValue = 0.0d;
int i = v.getId();
if (i == R.id.edt_to_up_down) {
curValue = this.cvToUpDown.getCurValue();
} else if (i == R.id.edt_to_left_right) {
curValue = this.cvToLeftRight.getCurValue();
} else if (i == R.id.edt_to_go_back) {
curValue = this.cvToGoBack.getCurValue();
}
v.setText(String.valueOf(curValue));
v.clearFocus();
}
/**
* 隐藏键盘
*
* @param v 焦点所在View
* @param ids 输入框
* @return true代表焦点在edit上
*/
public boolean isFocusEditText(View v, int... ids) {
if (v instanceof EditText) {
EditText tmp_et = (EditText) v;
for (int id : ids) {
if (tmp_et.getId() == id) {
return true;
}
}
}
return false;
}
/**
* 隐藏键盘
*
* @param v 焦点所在View
* @param ids 输入框
* @return true代表焦点在edit上
*/
private boolean isFocusEditText(View v, int... ids) {
if (v instanceof EditText) {
EditText tmp_et = (EditText) v;
for (int id : ids) {
if (tmp_et.getId() == id) {
return true;
}
}
}
return false;
}
private boolean isAnyWriteFieldEmpty() {
for (EditText e : editTexts) {
if (e.getId() == EDIT_NOT_CLEAR_ID) continue;
if (e.getText().toString().isEmpty()) return true;
}
return false;
}
@BindingAdapter("judgehint")
public static void setHint(EditText view, CharSequence hint) {
switch (view.getId()) {
case R.id.edit_options_logcat:
String options = "[options]";
if (!hint.equals("")) {
options = hint.toString();
}
view.setHint(options);
break;
case R.id.edit_filter_logcat:
String filter = "[filterspecs]";
if (!hint.equals("")) {
filter = hint.toString();
}
view.setHint(filter);
break;
case R.id.edit_grep_logcat:
String grep = "[grep]";
if (!hint.equals("")) {
grep = hint.toString();
}
view.setHint(grep);
break;
default:
ZLog.e("no match");
break;
}
}
/**
* 隐藏键盘
*
* @param v 焦点所在View
* @param ids 输入框
* @return true代表焦点在edit上
*/
private boolean isFocusEditText(View v, int... ids) {
if (v instanceof EditText) {
EditText tmp_et = (EditText) v;
for (int id : ids) {
if (tmp_et.getId() == id) {
return true;
}
}
}
return false;
}
/**
* 隐藏键盘
*
* @param v 焦点所在View
* @param ids 输入框
* @return true代表焦点在edit上
*/
public boolean isFocusEditText(View v, int... ids) {
if (v instanceof EditText) {
EditText tmp_et = (EditText) v;
for (int id : ids) {
if (tmp_et.getId() == id) {
return true;
}
}
}
return false;
}