Android系统增加按键标准实现
DVB所需的按键如下:
Framework中的按键定义
数字键
/** Key code constant: '0' key. */
public static final int KEYCODE_0 = 7;
/** Key code constant: '1' key. */
public static final int KEYCODE_1 = 8;
/** Key code constant: '2' key. */
public static final int KEYCODE_2 = 9;
/** Key code constant: '3' key. */
public static final int KEYCODE_3 = 10;
/** Key code constant: '4' key. */
public static final int KEYCODE_4 = 11;
/** Key code constant: '5' key. */
public static final int KEYCODE_5 = 12;
/** Key code constant: '6' key. */
public static final int KEYCODE_6 = 13;
/** Key code constant: '7' key. */
public static final int KEYCODE_7 = 14;
/** Key code constant: '8' key. */
public static final int KEYCODE_8 = 15;
/** Key code constant: '9' key. */
public static final int KEYCODE_9 = 16;
kl文件映射名称:
{ "0", 7 },
{ "1", 8 },
{ "2", 9 },
{ "3", 10 },
{ "4", 11 },
{ "5", 12 },
{ "6", 13 },
{ "7", 14 },
{ "8", 15 },
{ "9", 16 },
DPAD
/** Key code constant: Directional Pad Up key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_UP = 19;
/** Key code constant: Directional Pad Down key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_DOWN = 20;
/** Key code constant: Directional Pad Left key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_LEFT = 21;
/** Key code constant: Directional Pad Right key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_RIGHT = 22;
/** Key code constant: Directional Pad Center key.
* May also be synthesized from trackball motions. */
public static final int KEYCODE_DPAD_CENTER = 23;
kl文件映射名称:
{ "DPAD_UP", 19 },
{ "DPAD_DOWN", 20 },
{ "DPAD_LEFT", 21 },
{ "DPAD_RIGHT", 22 },
{ "DPAD_CENTER", 23 },
音量+-键、*键、#键
/** Key code constant: '*' key. */
public static final int KEYCODE_STAR = 17;
/** Key code constant: '#' key. */
public static final int KEYCODE_POUND = 18;
/** Key code constant: Volume Up key.
* Adjusts the speaker volume up. */
public static final int KEYCODE_VOLUME_UP = 24;
/** Key code constant: Volume Down key.
* Adjusts the speaker volume down. */
public static final int KEYCODE_VOLUME_DOWN = 25;
/** Key code constant: Volume Mute key.
* Mutes the speaker, unlike {@link #KEYCODE_MUTE}.
* This key should normally be implemented as a toggle such that the first press
* mutes the speaker and the second press restores the original volume. */
public static final int KEYCODE_VOLUME_MUTE = 164;
kl文件映射名称:
{ "STAR", 17 },
{ "POUND", 18 },
{ "VOLUME_UP", 24 },
{ "VOLUME_DOWN", 25 },
{ "VOLUME_MUTE", 164 },
Home键、上一页、下一页、菜单、回看键(返回键)
/** Key code constant: Home key.
* This key is handled by the framework and is never delivered to applications. */
public static final int KEYCODE_HOME = 3;
/** Key code constant: Page Up key. */
public static final int KEYCODE_PAGE_UP = 92;
/** Key code constant: Page Down key. */
public static final int KEYCODE_PAGE_DOWN = 93;
/** Key code constant: Menu key. */
public static final int KEYCODE_MENU = 82;
/** Key code constant: Back key. */
public static final int KEYCODE_BACK = 4;
kl文件映射名称:
{ "HOME", 3 },
{ "PAGE_UP", 92 },
{ "PAGE_DOWN", 93 },
{ "MENU", 82 },
{ "BACK", 4 },
信息键、频道+、频道-
/** Key code constant: Info key.
* Common on TV remotes to show additional information related to what is
* currently being viewed. */
public static final int KEYCODE_INFO = 165;
/** Key code constant: Channel up key.
* On TV remotes, increments the television channel. */
public static final int KEYCODE_CHANNEL_UP = 166;
/** Key code constant: Channel down key.
* On TV remotes, decrements the television channel. */
public static final int KEYCODE_CHANNEL_DOWN = 167;
kl文件映射名称:
{ "INFO", 165 },
{ "CHANNEL_UP", 166 },
{ "CHANNEL_DOWN", 167 },
电视键、指南键、画中画
/** Key code constant: TV key.
* On TV remotes, switches to viewing live TV. */
public static final int KEYCODE_TV = 170;
/** Key code constant: Guide key.
* On TV remotes, shows a programming guide. */
public static final int KEYCODE_GUIDE = 172;
/** Key code constant: Window key.
* On TV remotes, toggles picture-in-picture mode or other windowing functions. */
public static final int KEYCODE_WINDOW = 171;
kl文件映射名称:
{ "TV", 170 },
{ "GUIDE", 172 },
{ "WINDOW", 171 },
播放控制按键:播放/暂停、停止、下一个、上一个、快退、快进、播放、暂停、录制
/** Key code constant: Play/Pause media key. */
public static final int KEYCODE_MEDIA_PLAY_PAUSE= 85;
/** Key code constant: Stop media key. */
public static final int KEYCODE_MEDIA_STOP = 86;
/** Key code constant: Play Next media key. */
public static final int KEYCODE_MEDIA_NEXT = 87;
/** Key code constant: Play Previous media key. */
public static final int KEYCODE_MEDIA_PREVIOUS = 88;
/** Key code constant: Rewind media key. */
public static final int KEYCODE_MEDIA_REWIND = 89;
/** Key code constant: Fast Forward media key. */
public static final int KEYCODE_MEDIA_FAST_FORWARD = 90;
/** Key code constant: Play media key. */
public static final int KEYCODE_MEDIA_PLAY = 126;
/** Key code constant: Pause media key. */
public static final int KEYCODE_MEDIA_PAUSE = 127;
/** Key code constant: Record media key. */
public static final int KEYCODE_MEDIA_RECORD = 130;
kl文件映射名称:
{ "MEDIA_PLAY_PAUSE", 85 },
{ "MEDIA_STOP", 86 },
{ "MEDIA_NEXT", 87 },
{ "MEDIA_PREVIOUS", 88 },
{ "MEDIA_REWIND", 89 },
{ "MEDIA_FAST_FORWARD", 90 },
{ "MEDIA_PLAY", 126 },
{ "MEDIA_PAUSE", 127 },
{ "MEDIA_RECORD", 130 },
红、绿、黄、蓝按键
/** Key code constant: Red "programmable" key.
* On TV remotes, acts as a contextual/programmable key. */
public static final int KEYCODE_PROG_RED = 183;
/** Key code constant: Green "programmable" key.
* On TV remotes, actsas a contextual/programmable key. */
public static final int KEYCODE_PROG_GREEN = 184;
/** Key code constant: Yellow "programmable" key.
* On TV remotes, acts as a contextual/programmable key. */
public static final int KEYCODE_PROG_YELLOW = 185;
/** Key code constant: Blue "programmable" key.
* On TV remotes, acts as a contextual/programmable key. */
public static final int KEYCODE_PROG_BLUE = 186;
kl文件映射名称:
{ "PROG_RED", 183 },
{ "PROG_GREEN", 184 },
{ "PROG_YELLOW", 185 },
{ "PROG_BLUE", 186 },
自定义功能键:声道、喜爱键、NVOD、邮件、新媒体键、一卡通、客户服务、交互游戏、阳光政务(有些为天天餐桌)、股票信息、文件管理、鼠标键
/** Key code constant: F1 key. */
public static final int KEYCODE_F1 = 131;
/** Key code constant: F2 key. */
public static final int KEYCODE_F2 = 132;
/** Key code constant: F3 key. */
public static final int KEYCODE_F3 = 133;
/** Key code constant: F4 key. */
public static final int KEYCODE_F4 = 134;
/** Key code constant: F5 key. */
public static final int KEYCODE_F5 = 135;
/** Key code constant: F6 key. */
public static final int KEYCODE_F6 = 136;
/** Key code constant: F7 key. */
public static final int KEYCODE_F7 = 137;
/** Key code constant: F8 key. */
public static final int KEYCODE_F8 = 138;
/** Key code constant: F9 key. */
public static final int KEYCODE_F9 = 139;
/** Key code constant: F10 key. */
public static final int KEYCODE_F10 = 140;
/** Key code constant: F11 key. */
public static final int KEYCODE_F11 = 141;
/** Key code constant: F12 key. */
public static final int KEYCODE_F12 = 142;
相应的kl文件对应:
{ "F1", 131 },
{ "F2", 132 },
{ "F3", 133 },
{ "F4", 134 },
{ "F5", 135 },
{ "F6", 136 },
{ "F7", 137 },
{ "F8", 138 },
{ "F9", 139 },
{ "F10", 140 },
{ "F11", 141 },
{ "F12", 142 },
Android系统增加按键标准实现
最新推荐文章于 2021-06-07 15:51:13 发布