android_基础



// 监控输入框的换行符,回车,完成等事件
vCode.setOnEditorActionListener(new TextView.OnEditorActionListener() {
	@Override
	public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
		if (null != keyEvent) {
			// 这里是 keyEvent, 监控回车
			if (keyEvent.getAction() == KeyEvent.ACTION_UP) {
				doQuery();
			}
		} else {
			// 这里是 IME_ACTION, 监控完成事件(键盘收起)等
			doQuery();
		}
		// 另外: 判断id的用法: if (id == EditorInfo.IME_ACTION_DONE)
		return false;
	}
});



//代码设置颜色
int colorValue = activity.getResources().getColor(R.color.wheat);
vCardValue.setTextColor(colorValue);

猜你喜欢

转载自zheyiw.iteye.com/blog/2119881