Reputation: 21
I've developed an Android application for phones that works fine and uses the settings/menu key present on all android phones, but when I tested in on a tablet, I realized there was no such key. It seems that applications such as memo, maps, and the browser, all use a bar at the top with a menu/settings button (like the one seen here: https://web.archive.org/web/1/http://i.techrepublic%2ecom%2ecom/blogs/differences_browser_settings_tablet.png?tag=content;siu-container).
I've searched around to see how to change the settings menu to a button on the top bar on tablets but keep it for phones, but haven't found anything yet. So my question is how do I add that bar with that button to the top of the application when running on a tablet and not when running on a phone?
EDIT: After some more searching I found that it appears to be called an ActionBar: http://www.androiduipatterns.com/2011/06/tablet-ui-patterns-action-bar.html
I am still wondering what the best way to integrate this is. Should I have two applications, one for tablet and one for phone, or will I just have to change the xml layout for tablets and it should work?
Upvotes: 2
Views: 4567
Reputation: 547
This is not just phones vs tablets, it's android V1+2 vs android V3 and 4 (4 also runs on phones!) For instance, galaxy nexus phone comes with android 4 and has no hardware menu key.
developer.android.com has a fair bit of information about how you can do this. Mostly you want to look into backwards compatibility (ie, running android 1-2 on android 3 and 4 OS)
Maybe also learning about layouts for different sized devices could be helpful.
http://developer.android.com/guide/practices/ui_guidelines/index.html
http://developer.android.com/guide/practices/tablets-and-handsets.html
PS, just played with a demo app I've been mucking about with for my phone - the app is targeted to android 2.1 SDK and has a menu button menu. When I load it up in an android 4.0 emulator, the menu as it used to appear on my phone is available in the action bar, when I click on the icon that is three vertical dots.
Upvotes: 3