creating a bottom bar menu - android

I am looking into ways of building a bottom menu bar in android. I was initially planning to make use of splitting the action bar with the uiOptions:splitWhenNarrow but unfortunately that only applies to phone screens.
I am aiming to design for nexus 7, so slightly bigger screen!
I came across one tutorial which I've linked below. It seems like just the thing I was looking for but before I dive into the coding I just wanted to check whether it's a good way of doing such a thing?
Perhaps someone can suggest an alternative? I'm relatively new to android so this is a huge learning curve for me and I am trying to develop based on the best practices.
Many thanks.
http://www.paxmodept.com/telesto/blogitem.htm?id=810
*The menu bar in the tutorial is pretty much what I am trying to achieve.

Related

General android layout questions

I should begin by saying that I'm brand new to android development, although I have a good understanding of the fundamentals of java. That being said, I usually learn best by doing, so I'm writing an app for a campus magazine I work for and trying to learn through the process of making it.
At the top of the screen is a bar with two spinners labeled "issues" and "sections," which allow the user to filter the articles shown to only those in the respective issue / section. The rest of the screen is taken up by what I will describe as a vertically-oriented gallery, which shows the headline for each story underneath an image associated with it. The user can then "flip" through the stories in the magazine by scrolling through the "gallery." Selecting one of the stories will open the full story up in ViewPager.
I have two main questions at this point:
1) Initially, I planned to place the "issues" and "sections" spinners in the ActionBar. However, as I understand it, ActionBars are not displayed to users using Android 2.x. Given that these elements are critical to navigating the app, and that a majority of android users are still using 2.x, this seems unacceptable. As a result, I'm using an ActionBar-less theme and essentially drawing my own action bar via a linear layout on top of my main activity. Am I correct in my understanding that ActionBars do not display on Android 2.x devices? If so, am I correct in including my "tool bar" as a part of the main activity, or is there a better way to implement it? (Perhaps as a fragment? I don't really understand how those fit in yet...).
2) I am aware that the gallery widget is deprecated, so obviously I'm not going to use it. What alternative widgets would best achieve the same visual goal of having the user "flip" through the stories in the magazine by scrolling through the widget? Is there a way to animate a ListView to achieve this goal?
Again, any help - particularly which helps me to understand the wider issues involved here - will be greatly appreciated.
Thanks in advance.
You can use ActionBarSherlock - it is compatible down to Android v 1.6.
ViewPager might help you

Correct Way To Implement A Tabbed Bar

I have been browsing the web for a while now and looking at different examples of how to implement a tab bar.
The problem I am having is deciding the correct approach to creating this feature. The option that seems most used is to have one main activity called MainActivity or something and using fragments as the tabs. This is all well and good and I have created an application like this fine.
The problem I am having is I am in two minds as to whether this is the right way to go about it as coming from an iOS development background it just doesn't seem right due to these tabs having different functions.
Any pointers would be great.
EDIT I have also looked into ActionBarSherlock but couldn't get to use it in a project as it kept coming up with errors and I couldn't find a thread that sorted the problems I was having out.
Disco
You should be using fragments, yes. There is an example of how to do it here: http://developer.android.com/guide/topics/ui/actionbar.html#Tabs
This "only" works with Tabs that are part of your Actionbar, though. Shouldn't be too much of a problem, because they usually should be part of your Actionbar. You can also manually move the tabs if you're not content with their location, or roll your own buttons that look like tabs.
Keep in mind that tabs in Android aren't quite the same beast as the tab bar is in iOS. They look similar and behave similar, but there are subtle conceptual differences in how they are supposed to be used. Don't use them for your basic app navigation, but rather for switching between similar "things".
If you want to employ this on device pre-3.0 though, you will have to use ActionBarSherlock. It does work fine and we're using it in several projects, so if you're having problems integrating it I suggest creating a new question for that, I'll be happy to help.

Is there a way to move the android Honeycomb action bar?

I like how the Android 3.0+ action bar looks, but I don't want it to be on top of the screen. Is there a way to move it to the bottom or to the side?
It is not possible to do so. At least not using public APIs. You could easily find a way to do it but your app would be inconsistent with other apps and likely to break with future updates of the OS.
I think you may have some luck if you delve deep enough into ActionBarSherlock's source code. Since that library creates an ActionBar for pre-HC devices, you may be able to just change the position where it appears. This isn't exactly the answer you were looking for, but it just might be able to solve your problem.

Is there an Android Tablet equivalent of UIPopOverController?

I'm just mucking around with Android tablet stuff in 3.0. I have fragments set up to do the equivalent of UISplitViewController for iPad. Anyone know what the best solution to get something like the iPad UIPopOverController is?
I'm thinking the options are either a separate dialog or something in the Action Bar ...?
I haven't actually seen any Android tablets running 3.0 so not clear what the standard will be ...
Many thanks in advance
This may not be exactly what you are looking for because I'm not all that familiar with UIPopOverController but I think you can accomplish something similar using a Toast with a customized layout.
I would take a look at Creating Toast Notifications and see if it works for you.
Depending on the functionality needed it might work, otherwise you might need to look into trying to generate a modeless dialog with a custom layout.
As for your other question, yes options are generally stored in a separate activity within your application and following Honeycomb design the options activity would be accessible from the Action Bar and the options itself could be a fragment.
Its nothing official but I would crack open the source code to the contacts app for 2.0+ They emulate the popover UI using an Activity in a pretty creative way. It might be a little over kill as it was designed to be usable by any application not just itself. But it should help give you a nudge in the right direction.
Also depending on what the behavior you are looking for exactly a combination of fragments and action bar could be the way to go, but its not going to be as easy as iOS.

Is there a way to make Android tabs slide?

I'm new to Android development, and I was wondering if anyone knew either how to make Tabs slide, or how to get a similar effect without tabs. I have quite a few tabs in my application, and it does not look good on devices with smaller screens. Or maybe tabs are not what I am looking for. If you don't know what I'm talking about, I'd like to reproduce something similar to Photoshop.com Mobile's effects screen.
I know this is possible. Thanks in advance!
I haven't experimented w/ sliding tabs, but I know other applications I have used have a panel at the top with buttons, and that is slide-able so that you can slide for the content needed and select. It does the same thing without the tabs, and should only be a little more overhead from the code side of things.

Categories

Resources