Is there a way to create an android AVD with a system bar like in honeycomb? When I create any AVD I get "hard" keys to appear as part of the emulator and no system bar like in honeycomb. Anyway to get a system bar to show up?
6 Answers
You can do this by creating a new AVD and setting its screen resolution to wxga720. This will make it a "tablet" device.
For those who are actually interested in what is going on here, by creating a device with wxga720 resolution a hardware property called Hardware Back/Home keys is created and set to no. Also, another property called Keyboard lid support is set to no. These two together are what actually get rid of the "hard keys".
-
1I'm having a very similar problem. The wxga720 skin doesn't fix it. The "hardware" buttons are gone, but there is no system bar and thus no home/back/etc.
hw.mainKeysandhw.keyboard.lidare both set tono. Very frustrating.– Joel FOct 25, 2011 at 18:19 -
I've done this, and still don't have the system bar with soft buttons nor hard buttons. Lol. It's kinda hard to use like this.– terryhauOct 28, 2011 at 3:38
There is a bug in Android that sets the keyboard lid to 'yes' regardless of whether you type 'yes' or 'no'. You can look under your home directory's ".android" folder, look under "avds" then the AVD you craeted, and go edit the config.ini file to set it to 'no'
Here's what worked for me, on both the WXGA720 skin and custom 1280x800 resolution:
Option A: Edit config.ini
- Navigate to the AVD directory (
.android/avd/<name-of-avd>.avd/) - Open
config.iniin your desired text editor - Set
hw.lcd.density=160 - Save
Option B: Edit in Android SDK Manager (GUI)
- Click
Tools|Manage AVDs... - Select Android Virtual Device to edit
- Click
Edit... - Click the Value for the
Abstracted LCD densityproperty - Enter
160 - Click
Edit AVDto save
After editing the density, start the AVD and enjoy the Ice Cream Sandwich tablety goodness. :)
It seems like the logic in the emulator that determines whether to present a phone or tablet interface is based on the calculated physical size of the virtual device's screen, which is dependent on two parameters: screen size and pixel density.
Like others, I had used the built-in WXGA720 skin hoping to work with the tablet interface, and was disappointed to be presented with a phone interface in landscape orientation. I even tried a new device with a custom resolution of 1280x800 and set hw.mainKeys and hw.keyboard.lid in the config.ini to no avail.
The WXGA720 skin's default density of 320 produces a calculated screen size of 4.6" diagonal (4" x 2.25"), which I'm surmising is within the emulator's esoteric threshold for a phone device. Even the custom resolution of 1280x800, defaulting at a density of 240 and thereby sporting a whopping 6.3" diagonal (!), is rendered with a phone interface.
Some well-named default AVD skins in the SDK ("WXGA720-phone" & "WXGA720-tablet", e.g.) would help eliminate the confusion here. Perhaps we should nag Google.
I spent some time looking for this and digged trough Android 4.0 source to figure how it works. This is what I found out:
- Android decides whether to go into tablet mode using isTabletUI function. The function just checks if the screen is XLARGE. By further digging into the code I found that screen is detected as XLARGE if its larger then 800x600 at medium density. I've managed to make it run with systembar at 120 dpi with 600x450 resolution.
- There apears to be no way of making Android Emulator behave like Galaxy Nexus, that is have Phone interface with status bar and systembar. It will either have status bar (phone ui) or system bar (tablet ui). In other words it appears Galaxy Nexus is not running vanilla version of ICS as I would have expected..
Actually it's pretty easy, just go to the AVD Manager (the program that manages the emulator virtual images), select the Android 4 image, then add the property "Hardware Back/Home keys" and set it to "no
(from http://www.dandandin.net/how-to-show-the-new-softkeys-in-the-ice-cream-sandwich-emulator)
You're sure you picked the right API level too? That one got me the first time, I thought I clicked on the right one, but I hadn't.