I am trying to implement an ActionBar into my existing project but don't know where to start. I immediately started building a classic menu button menu, before I realized that it is deprecated and some devices (nexus 7) can't access such menus.
What is a good way of implementing an ActionBar over a map? I am already deep into this project and it is due in a couple of days so rewriting the program is not really an option.
What I am really looking for is two or three simple options always available at the top or bottom of the map which extend to a list if clicked. Thanks !
For implementing ActionBar in a back-compatible way you would probably want to use ActionBarSherlock and its Maps plugin.
Take a look at its samples, it's pretty simple to use.
Related
I want to setup a 'tabbed' application. Looking through all the tutorials including the google docs here:
http://developer.android.com/training/implementing-navigation/lateral.html
However as I start to go through the docs I get all kinds of deprecated warnings:
actionBar.setSelectedNavigationItem(position);
I would really like to start off right and use any new non deprecated methods. Most examples of tab applications are years old. What am I missing? Am I searching for the wrong thing? Can someone point me in the right direction for developing a tabbed application.
What am I missing?
Action bar tabs were deprecated in Android 5.0, last fall.
Can someone point me in the right direction for developing a tabbed application.
Use TabLayout, though this is a very new addition to the Android Support libraries.
Or, use ViewPager with your favorite tabbed indicator, of which there are many.
Or, use FragmentTabHost.
I want to make a moving list appear from the left of the screen of the activity in the android app.
Something like the facebook app shown below :
,,
how can I make something like that in an android app.
Thanks.
This is a very popular UI pattern called a sliding menu / slider. You can search for open source libraries / projects which implement this for you.
Here is the first one I found on google.
This one is useful if you want to support old (pre holo) android devices too. It's an addon to the excellent holoeverywhere library.
And last but not least, take a look at this official pattern by google which also implements the same behavior. The code for creating it is available here.
The concept behind this is that you are taking a screen grab of the current activity and then loading in the menu. Your not actually sliding between activities, your moving the screen shot. Thats a very basic explanation of whats happening.
If you search for slide navigation on github I'm sure you'll find something.
I got stuck with Jake Wharton ViewPagerIndicator.
The problem is that when I try to make a Tab indicator - the result I'm getting is extremely different from what I need and I can't get to style it or make it behave as it should.
So, what I ask for is two things:
1) Am I right when I say that TabIndicator is Foursquare-like ViewPagerIndicator? (when all tabs are shown on screen)
2) Can anyone provide me links to some tutorials or samples of using this type of ViewPagerIndicator, cause samples from JWs' site don't want to get working.
Thanks a lot for your attention!
Jake Wharton provides a lot of examples. Have you checked it?
https://github.com/JakeWharton/Android-ViewPagerIndicator
And you can take a preview installing this apk:
https://play.google.com/store/apps/details?id=com.viewpagerindicator.sample&hl=es
moskis is right on about ViewPagerIndicator. Installing that APK helped me a lot when I first started working with it and it is a great library.
However, to answer the first part of your question and what I think you are asking in general, I think ViewPagerIndicator isn't what you need to solve this specific problem. Foursquare's tabs at the top are the standard Android tabs as shown in http://developer.android.com/design/building-blocks/tabs.html.
Standard Android tabs are implemented using a TabHost and TabWidget. There is an official tutorial about creating a tabbed interface at http://developer.android.com/guide/topics/ui/layout/tabs.html
Foursquare achieves a custom look by providing state-list drawables for the tabs and you will probably want to provide your own to get the style that you want for your app.
Note that I don't have access to the Foursquare implementation, but am going off of what I observe whiel using the app. However, I have implemented a tabbed interface for Android in past projects.
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.
I cannot find either one of these two views in the source, but have seen them both in many apps. Can anyone please tell me what they are called?
Thanks
The second one is an options menu from the action bar. I think it is implemented as a ListPopupWindow.
The first one is not part of the Android SDK, though there are various implementations floating around. Here is an example of one designed for use with Google Maps, for example. Here is one designed for the "quick actions" pattern.
I'm going to assume that they're custom made ones, so you won't find them in the standard Android libraries.
The second one I think is just the way that the default menu looks in ICS (and honeycomb for that matter). If you build for 4.0 and include the code for an options menu I think you'll get that UI by default. If you are looking to customize it check out this page http://developer.android.com/guide/topics/ui/actionbar.html and pay close attention to the "Adding drop down navigation" section.
The first one is not a part of the android UI, that is something specific to the facebook app.