您的位置:首页 > 移动开发 > Android开发

android控制PC

2015-05-31 18:49 393 查看
备忘

/*数字键1-9*/
case KeyEvent.KEYCODE_0: this.packSendOrder("KEYCODE_0");break;
case KeyEvent.KEYCODE_1: this.packSendOrder("KEYCODE_1");break;
case KeyEvent.KEYCODE_2: this.packSendOrder("KEYCODE_2");break;
case KeyEvent.KEYCODE_3: this.packSendOrder("KEYCODE_3");break;
case KeyEvent.KEYCODE_4: this.packSendOrder("KEYCODE_4");break;
case KeyEvent.KEYCODE_5: this.packSendOrder("KEYCODE_5");break;
case KeyEvent.KEYCODE_6: this.packSendOrder("KEYCODE_6");break;
case KeyEvent.KEYCODE_7: this.packSendOrder("KEYCODE_7");break;
case KeyEvent.KEYCODE_8: this.packSendOrder("KEYCODE_8");break;
case KeyEvent.KEYCODE_9: this.packSendOrder("KEYCODE_9");break;
/*字母键a-z*/
case KeyEvent.KEYCODE_A:this.packSendOrder("KEYCODE_A");break;
case KeyEvent.KEYCODE_B:this.packSendOrder("KEYCODE_B");break;
case KeyEvent.KEYCODE_C:this.packSendOrder("KEYCODE_C");break;
case KeyEvent.KEYCODE_D:this.packSendOrder("KEYCODE_D");break;
case KeyEvent.KEYCODE_E:this.packSendOrder("KEYCODE_E");break;
case KeyEvent.KEYCODE_F:this.packSendOrder("KEYCODE_F");break;
case KeyEvent.KEYCODE_G:this.packSendOrder("KEYCODE_G");break;
case KeyEvent.KEYCODE_H:this.packSendOrder("KEYCODE_H");break;
case KeyEvent.KEYCODE_I:this.packSendOrder("KEYCODE_I");break;
case KeyEvent.KEYCODE_J:this.packSendOrder("KEYCODE_J");break;
case KeyEvent.KEYCODE_K:this.packSendOrder("KEYCODE_K");break;
case KeyEvent.KEYCODE_L:this.packSendOrder("KEYCODE_L");break;
case KeyEvent.KEYCODE_M:this.packSendOrder("KEYCODE_M");break;
case KeyEvent.KEYCODE_N:this.packSendOrder("KEYCODE_N");break;
case KeyEvent.KEYCODE_O:this.packSendOrder("KEYCODE_O");break;
case KeyEvent.KEYCODE_P:this.packSendOrder("KEYCODE_P");break;
case KeyEvent.KEYCODE_Q:this.packSendOrder("KEYCODE_Q");break;
case KeyEvent.KEYCODE_R:this.packSendOrder("KEYCODE_R");break;
case KeyEvent.KEYCODE_S:this.packSendOrder("KEYCODE_S");break;
case KeyEvent.KEYCODE_T:this.packSendOrder("KEYCODE_T");break;
case KeyEvent.KEYCODE_U:this.packSendOrder("KEYCODE_U");break;
case KeyEvent.KEYCODE_V:this.packSendOrder("KEYCODE_V");break;
case KeyEvent.KEYCODE_W:this.packSendOrder("KEYCODE_W");break;
case KeyEvent.KEYCODE_X:this.packSendOrder("KEYCODE_X");break;
case KeyEvent.KEYCODE_Y:this.packSendOrder("KEYCODE_Y");break;
case KeyEvent.KEYCODE_Z:this.packSendOrder("KEYCODE_Z");break;
/*功能键F1-F12*/
case KeyEvent.KEYCODE_F1:this.packSendOrder("KEYCODE_F1");break;
case KeyEvent.KEYCODE_F2:this.packSendOrder("KEYCODE_F2");break;
case KeyEvent.KEYCODE_F3:this.packSendOrder("KEYCODE_F3");break;
case KeyEvent.KEYCODE_F4:this.packSendOrder("KEYCODE_F4");break;
case KeyEvent.KEYCODE_F5:this.packSendOrder("KEYCODE_F5");break;
case KeyEvent.KEYCODE_F6:this.packSendOrder("KEYCODE_F6");break;
case KeyEvent.KEYCODE_F7:this.packSendOrder("KEYCODE_F7");break;
case KeyEvent.KEYCODE_F8:this.packSendOrder("KEYCODE_F8");break;
case KeyEvent.KEYCODE_F9:this.packSendOrder("KEYCODE_F8");break;
case KeyEvent.KEYCODE_F10:this.packSendOrder("KEYCODE_F10");break;
case KeyEvent.KEYCODE_F11:this.packSendOrder("KEYCODE_F11");break;
case KeyEvent.KEYCODE_F12:this.packSendOrder("KEYCODE_F12");break;
/*符号键 从Mac 键盘上从上到下从左到右——须知并不是所有的符号都能在android中找到对应
* 所以我们不能只用这种方法来搞,我们应该换一个思路*/
//键盘第二行
case KeyEvent.KEYCODE_GRAVE:	this.packSendOrder("`");break;
//				case KeyEvent.KEYCODE_POUND:	this.packSendOrder("~");break;
//				case KeyEvent.KEYCODE_POUND:	this.packSendOrder("!");break;
case KeyEvent.KEYCODE_AT:				this.packSendOrder("@");break;
//				case KeyEvent.KEYCODE_POUND:	this.packSendOrder("#");break;
//				case KeyEvent.KEYCODE_POUND:	this.packSendOrder("$");break;
//				case KeyEvent.KEYCODE_POUND:	this.packSendOrder("%");break;
//				case KeyEvent.KEYCODE_POUND:	this.packSendOrder("^");break;
//				case KeyEvent.KEYCODE_POUND:	this.packSendOrder("&");break;
case KeyEvent.KEYCODE_STAR:		this.packSendOrder("*");break;
case KeyEvent.KEYCODE_NUMPAD_LEFT_PAREN:	this.packSendOrder("(");break;
case KeyEvent.KEYCODE_NUMPAD_RIGHT_PAREN:	this.packSendOrder(")");break;
case KeyEvent.KEYCODE_POUND:	this.packSendOrder("_");break;
case KeyEvent.KEYCODE_EQUALS:	this.packSendOrder("=");break;
case KeyEvent.KEYCODE_MINUS:	this.packSendOrder("-");break;
case KeyEvent.KEYCODE_PLUS:		this.packSendOrder("+");break;
//第三行 6
case KeyEvent.KEYCODE_LEFT_BRACKET:this.packSendOrder("[");break;
case KeyEvent.KEYCODE_RIGHT_BRACKET:this.packSendOrder("]");break;
//				case KeyEvent.KEYCODE_PLUS:this.packSendOrder("{");break;
//				case KeyEvent.KEYCODE_PLUS:this.packSendOrder("}");break;
case KeyEvent.KEYCODE_BACKSLASH:this.packSendOrder("\\");break;
//				case KeyEvent.KEYCODE_PLUS:this.packSendOrder("|");break;
//第四行 4
case KeyEvent.KEYCODE_SEMICOLON:this.packSendOrder(";");break;
//				case KeyEvent.KEYCODE_PLUS:this.packSendOrder(":");break;
case KeyEvent.KEYCODE_APOSTROPHE:this.packSendOrder("'");break;
//				case KeyEvent.KEYCODE_PLUS:this.packSendOrder("\"");break;
//第五行 6
case KeyEvent.KEYCODE_COMMA:this.packSendOrder(",");break;
case KeyEvent.KEYCODE_NUMPAD_DOT:this.packSendOrder(".");break;
//				case KeyEvent.KEYCODE_PLUS:this.packSendOrder("<");break;
//				case KeyEvent.KEYCODE_PLUS:this.packSendOrder(">");break;
case KeyEvent.KEYCODE_SLASH :this.packSendOrder("/");break;
//				case KeyEvent.KEYCODE_PLUS:this.packSendOrder("?");break;
//				case KeyEvent.KEYCODE_F1:this.packSendOrder("KEYCODE_F1");break;


应该是创建一个EditText+一个线程
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: