2011-07-27 13 views
2

Notre société développe une tablette Android et nous créons un émulateur pour tablette.Le problème est que nous avons des boutons supplémentaires présents dans notre tablette qui n'est pas présent dans l'émulateur de tablette android par défaut.Modifier l'émulateur par défaut

Quelqu'un peut-il pointer vers n'importe quelle ressource en ligne ou m'aider sur la façon de modifier l'émulateur android par défaut pour ajouter des boutons supplémentaires et attraper les événements générés par eux?

Je l'ai googlé, mais tous les résultats de recherche pointent vers la création d'un bouton pour l'application Android et non un bouton matériel pour l'émulateur.

+0

Vous développez une tablette physique ou vous développez une application pour une tablette déjà existante? Si cela existe déjà, peut-être l'un des add-ons tiers dans le gestionnaire sdk and avd vous aidera? – colithium

+0

@colithium Nous développons une tablette physique donc il n'y a aucun add-on qui aidera – Raghupathy

Répondre

2

Regardez sous les plates-formes/android-Whatever/skins/dans votre installation sdk

Choisissez l'une des peaux de l'émulateur qui est le plus proche de ce que vous voulez créer. Faites une copie sous un nouveau nom.

Modifiez les fichiers hardware.ini et layout, en ajoutant les png nécessaires au répertoire. Il semble assez trivial de comprendre par exemple, par exemple:

back { 
       image button.png 
       x 112 
       y 142 
} 

Utilisez l'option de ligne de commande pour l'emporter sur la peau lors du lancement, ou créer un AVD qui pointe vers la nouvelle peau.

+0

J'ai essayé d'ajouter le bouton dans le fichier de mise en page d'android-11 (tablette) et démarrer l'émulateur. Le bouton n'est pas affiché. Mais si j'essaie de l'ajouter dans la plate-forme android-10 (téléphone) le bouton est affiché. Pensez que la façon d'ajouter des boutons pour l'émulateur de téléphone et de tablette est différente. – Raghupathy

1

Peut-être que vous pouvez utiliser un fichier de liaison de clé personnalisé? Exécuter emulator -help-keyset-file pour obtenir:

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 
Questions connexes