2011-07-27 216 views
2

我們公司正在開發一款android平板電腦,並且我們正在爲平板電腦創建一個模擬器。問題是我們在我們的平板電腦中存在額外的按鈕,它並不存在於默認的android平板電腦模擬器中。修改默認模擬器

任何人都可以指向任何在線資源或幫助我如何修改默認的Android模擬器添加額外的按鈕並捕獲它們生成的事件?

我已經使用了它,但所有的搜索結果指向爲Android應用程序創建一個按鈕,而不是模擬器的硬件按鈕。

+0

您正在開發物理平板電腦,或者您正在爲現有的平板電腦開發應用程序?如果它已經存在,也許在android sdk和avd管理器中的第三方加載項之一會幫助你? – colithium

+0

@colithium我們正在開發物理平板電腦,所以沒有現有的附加組件,將有助於 – Raghupathy

回答

2

查找/ Android的隨時/外觀/在你的SDK安裝

挑選模擬器皮膚這是最接近你想要創建的之一。用新名稱複製一份。

編輯hardware.ini和佈局文件,添加任何必要的png到目錄。這似乎很瑣碎的例子搞清楚,比如:

back { 
       image button.png 
       x 112 
       y 142 
} 

使用命令行選項來啓動時過乘坐的皮膚,或創建一個指向新的皮膚AVD。

+0

我試圖在android-11(平板電腦)和 佈局文件中添加按鈕啓動模擬器。該按鈕不顯示。 但是,如果我嘗試在android-10平臺(手機)中添加它,則顯示的按鈕是 。 認爲爲手機和平板電腦模擬器添加按鈕的方式與 不同。 – Raghupathy

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