I'd like to create a navigation menu in my Android app: a bar always at the bottom of the screen, with 4 choices Home|Categories|Search|Favorites, and the current page highlighted.
It seems the options menu can hardly be customized, so I can't use it.
Do I have to add this navigation bar in every layout or is there any better solutions?
Thanks
Julien
It sounds like you're replicating an iPhone interface. As most Android phones have buttons along the bottom of the screen (Home, Back, etc) it's likely to be a bad idea to put navigation there as it's easy to hit the wrong one.
The Google-recommended approach is to use the Action Bar pattern, across the top of the screen, which is very clear, and means your app is consistent with others (look at Twitter, Google Maps, Facebook - they all use the action bar pattern).
From Honeycomb (v3.0) onwards:
http://developer.android.com/reference/android/app/ActionBar.html
A simple library to create an Action Bar on any version of Android
https://github.com/johannilsson/android-actionbar
To create an action bar that uses that library on versions earlier than 3.0, but uses the official implemention for v3.0+, try this:
https://github.com/JakeWharton/ActionBarSherlock
The action bar is highly customisable, but remember that a key to a nice user interface is consistency across the platform, i.e. your app consistent with other apps and the OS.
If you need a navigation with more items or items within a specific page, you can use TabLayout, but for your primary nav, use the action bar, that's what it's for.
Use the TabLayout
Related
I am looking to implement a menu like used on the Android Uber app.
It seems to be like an action bar on top with 3 small settings stripes on left side. (probably not a real action bar)
When clicking in that area a black menu slides out from the left and occupies 70% of the screen.
The right side of the screen still showing the map is darkened to keep focus on the menu.
I like that style, it looks good and everyone immediately knows how to use it.
I would like to have the same but don't know where to start or if there is maybe something available that would do something similar.
The actionbar itself only offers the menu on top right which is better for pure settings.
I also experimented with a split action bar having the menu items on bottom but that also seems superior to the clean interface Uber provides.
You want the Android Navigation Drawer. It's an Android sanctioned navigation pattern and more details about it can be found here. For some more technical documentation and an example of how to use it, you can find a sample over here. It works great with the Action Bar so shouldn't need anything too custom outside of what the Android v4 compat library gives you.
I would like to get an action bar (navigation or outlook bar) which contains e.g. 6 Icons with text. If I click on an Icon, I would like to replace the content area of the outer control (nesting the 6 buttons) by an inner control in addition to a small back menu on top of it. The back button could also indicate the location where we are. So it is close to the outlook bar used within microsoft office.
I am using android:minSdkVersion="8". So I did not take a closer look to the android action bar. I am currently using the tab control. However, the tab control is not really what I want. Or can this be adjusted to provide my described functionality? I create controls at runtime, so I can tweek it, if someone knows how to get it close to what I am searching for. As alternative I would appreciate a library, with such a control.
Android Support Library, revision 18 extend support of ActionBar down to API v7. There are good instructions how you can import it (v7 appcompat) to your project.
I want to show Action Bar like below.
I have already used this library clickhere
But it takes only two icons on Action Bar. If I add four items, then last two are shown me like menu. I want all in Action bar same as image above.
Is it possible? if yes, then HOW? Can I change Action Bar color or its default style available in Device?
Thanks in Advance.
I recommend you use this:
http://jgilfelt.github.com/android-actionbarstylegenerator/
to style your ActionBar.
If you want all the 4 icons to be there, just add this attribute to all the menu items:
android:showAsAction="always"
hello try this library
it sure help you And you may have to add you own logic to handle this in below 2.3 Android OS and above 3.0 Android OS.
there is many demo sample available like below :
There is no way you can be sure of the number of icons displayed in the action bar. There is a large varierty of Android devices out there and they all have different screen sizes. That's why you have to prioritize the actions available in a menu : the most important will be displayed as actions in the action bars and the others will be displayed in the "menu" : the action overflow.
You should think of actions in a functional way, not a graphical way.
With ref to Image that you attached you should decide which design pattern you want to use in your application, there are many UI patterns available for mobiles, tablets. The image you attached looks like Side Navigation UI pattern. It's better you decide which UI pattern perfect for your app.. then start implementing it with custom action bar libs (if you want action bar in less than Android 3.0 ver) or any other.
I am developing an app on Android and would like to use the similar menu bar like Google Plus or Facebook, when you click the button, the menu bar will slide in and will not occupy the whole screen. Any ideas on that?
Thanks.
A pretty popular library for accomplishing the 'sliding menu' effect (or 'drawer' as the design guidelines on the Android developer website prefer to call it) is Jeremy Feinstein's SlidingMenu. It's also compatible with ActionBarSherlock, in case your project is using that too. Unfortunately, at this stage there is no component built into the SDK that allows you to do easily accomplish the same thing.
There are also a couple of alternative implementations for a sliding menu (do a search either here on SO or Google), but I haven't checked those out for a little while. If I recall correctly, there are especially some variations in terms of whether the ActionBar is supposed to slide along with the content or stay fixed at the top of the screen.
You can use FrameLayout in parent view and use translate animation in menu layout to show the slide in and slide out effect.
I'm not sure what direction to take with a Tabbed layout.
I am targeting sdk 15, min sdk 11. Are tabs better left in the action bar or in the "body". I am not designing for tablets with this app (yet), but it seems tablets have tabs in the Action bar and smaller screens do not.
One of the main reasons why I ask is because Google does have some info on tabs here:
http://developer.android.com/design/building-blocks/tabs.html
But I can't seem to find it in their new "Develop" section. So I don't know if this has been deprecated? There used to be a good example on Tab layouts.
You can still use them. They are not deprecated. In the post android 3.0 versions the tabs have been placed in the action bar on tablets. on phones they are below the action bar in portrait and again in the action bar in landscape. it's is considered a good practice to follow those standards as android developer suggests. Now i haven't used the new implementations but rather a compatibility library called ActionBarSherlock. it is actually pretty good and its almost exactly the same in terms of usage as the regular tabs. you can find some good samples on how to implement what you need in there.
Also i am pretty sure you can find all the samples in your android sdk folder under samples/android-14 for example.
I always felt that its easier to browse through them from there as opposed to developer.android.
Hope this helps you.
"If you use navigation tabs in your action bar, once the action items are separated on a narrow screen, the navigation tabs may be able to fit into the main action bar rather than be separated into the "stacked action bar." Specifically, if you've disabled the action bar icon and title (with setDisplayShowHomeEnabled(false) and setDisplayShowTitleEnabled(false)), then the navigation tabs collapse into the main action bar."
http://developer.android.com/guide/topics/ui/actionbar.html
This is in fact part of the new design pattern.
If the tabs can fit into the main action bar, let them.
Usually if you're in portrait mode they wouldn't (except for the case stated in the above quote), but when you switch to landscape mode (or if you're on a tablet) they would easily fit.
Everything you find on the developer's site is recommended and is considered good practice. Further, the "design" and "develop" sections go hand in hand... the separation is not meant to imply that "only developers should look at 'develop'" or vice versa. You should treat each as equally important when writing your app.
So yes, it is recommended to implement your tabs with the action bar (as seen in FragmentTabs.java in the API Demos), and it is certainly not deprecated.