修改默认模拟器

时间:2011-07-27 20:19:42

标签: android android-emulator

我们公司正在开发一款Android平板电脑,我们正在为平板电脑创建一个模拟器。问题是我们的平板电脑中还有其他按钮,这些按钮在默认的Android平板电脑模拟器中不存在。

任何人都可以指向任何在线资源或帮助我如何修改默认的Android模拟器以添加其他按钮并捕获它们生成的事件?

我用谷歌搜索了它,但所有搜索结果都指向为Android应用程序创建一个按钮而不是模拟器的硬件按钮。

2 个答案:

答案 0 :(得分:2)

在你的sdk安装中的platforms / android-whatever / skins /下查看

选择一个最接近您要创建的模拟器外观。以新名称制作副本。

编辑hardware.ini和布局文件,向目录添加任何必要的png。通过例子弄清楚似乎很简单,例如:

back {
                image button.png
                x 112
                y 142
}

使用命令行选项在启动时覆盖皮肤,或创建指向新皮肤的avd。

答案 1 :(得分:1)

也许您可以使用自定义键绑定文件?获取emulator -help-keyset-file以获取:

C:\android-sdk-windows\tools>emulator -help-keyset-file

C:\android-sdk-windows\tools>
  on startup, the emulator looks for 'keyset' file that contains the
  configuration of key-bindings to use. the default location on this
  system is:

    C:\Users\Mitch\.android\default.keyset

  if the file doesn't exist, the emulator writes one containing factory
  defaults. you are then free to modify it to suit specific needs.

  this file shall contain a list of text lines in the following format:

    <command> [<modifiers>]<key>

  where <command> is an emulator-specific command name, i.e. one of:

    BUTTON_HOME         BUTTON_VOLUME_DOWN  BUTTON_DPAD_CENTER
    BUTTON_MENU         BUTTON_CAMERA       BUTTON_DPAD_LEFT
    BUTTON_STAR         CHANGE_LAYOUT_PREV  BUTTON_DPAD_RIGHT
    BUTTON_BACK         CHANGE_LAYOUT_NEXT  BUTTON_DPAD_UP
    BUTTON_CALL         TOGGLE_NETWORK      BUTTON_DPAD_DOWN
    BUTTON_HANGUP       TOGGLE_TRACING      ONION_ALPHA_UP
    BUTTON_POWER        TOGGLE_FULLSCREEN   ONION_ALPHA_DOWN
    BUTTON_SEARCH       TOGGLE_TRACKBALL
    BUTTON_VOLUME_UP    SHOW_TRACKBALL

  <modifers> is an optional list of <modifier> elements (without separators)
  which can be one of:

    Ctrl-     Left Control Key
    Shift-    Left Shift Key
    Alt-      Left Alt key
    RCtrl-    Right Control Key
    RShift-   Right Shift Key
    RAlt-     Right Alt key (a.k.a AltGr)

  finally <key> is a QWERTY-specific keyboard symbol which can be one of:

    BACKSPACE        8                O                KEYPAD_0
    TAB              9                P                UP
    CLEAR            COLON            Q                DOWN
    ENTER            SEMICOLON        R                RIGHT
    PAUSE            LESS             S                LEFT
    ESCAPE           EQUAL            T                INSERT
    SPACE            GREATER          U                HOME
    EXCLAM           QUESTION         V                END
    DOUBLEQUOTE      AT               W                PAGEUP
    HASH             LEFTBRACKET      X                PAGEDOWN
    DOLLAR           BACKSLASH        Y                F1
    AMPERSAND        RIGHTBRACKET     Z                F2
    QUOTE            CARET            DELETE           F3
    LPAREN           UNDERSCORE       KEYPAD_PLUS      F4
    RPAREN           BACKQUOTE        KEYPAD_MINUS     F5
    ASTERISK         A                KEYPAD_MULTIPLY  F6
    PLUS             B                KEYPAD_DIVIDE    F7
    COMMA            C                KEYPAD_ENTER     F8
    MINUS            D                KEYPAD_PERIOD    F9
    PERIOD           E                KEYPAD_EQUALS    F10
    SLASH            F                KEYPAD_1         F11
    0                G                KEYPAD_2         F12
    1                H                KEYPAD_3         F13
    2                I                KEYPAD_4         F14
    3                J                KEYPAD_5         F15
    4                K                KEYPAD_6         SCROLLOCK
    5                L                KEYPAD_7         SYSREQ
    6                M                KEYPAD_8         PRINT
    7                N                KEYPAD_9         BREAK

  case is not significant, and a single command can be associated to up
  to 3 different keys. to bind a command to multiple keys, use commas to
  separate them. here are some examples:

    TOGGLE_NETWORK      F8                # toggle the network on/off
    CHANGE_LAYOUT_PREV  Keypad_7,Ctrl-J   # switch to a previous skin layout