Best way for tab layouts with Android 4? - java

I want to start app-development for Android. I'm not new to java but the android sdk confuses me when searching for the "best" way to create a tab layout.
My first app should be simple.. I just need about 3 pages.
What is the best way to implement a tab layout? Maybe you can also tell me what ways I could take.

There are 2 ways to make a tabbed Activity.
1- TabActivity with a very simple tutorial here :
http://www.androidhive.info/2011/08/android-tab-layout-tutorial/
2- Fragments with another simple tutorial here :
http://android.codeandmagic.org/2011/07/android-tabs-with-fragments/
As of late, using Fragments has become the norm so you might want to check that out.
Good Luck

First it depends on your target android version. If you are planning for latest versions, then Fragments are best option for tab layout.

Related

I could do two different NavDrawers in the same Android App?

my problem is that:
I want to make a login service in my application and depending on which user logs in, go to a different NavDrawer activity. In Android Studio when you create the NavDrawer activity that comes by default, it generates one perfectly. But when I want to generate a different one, having the same name doesn't create anything.
The only way I have found is by refactoring everything generated by the Android Studio wizard and changing all the names of the layouts.
I would like to know if there is an easier way to create another NavDrawer without having to refactor so much and without so many errors.
Thank you!
NavDrawers Generated
Conceptual Scheme
Its Solved, you only need to make an instance of one of these nav drawers and then extend that to another one.

A horizontal selector for tips

I'm looking to implement tips into my app, and I really like this style of selector I'm attaching here (it's a screenshot from an iOS app). Is there something equivalent to this sort of horizontal selector on the Android side? Or should I just be squashing buttons or other views together?
Thanks for the help, I have also considered using a spinner instead, but I like this sort of style of all the options shown at one time in one line.
Yes. They are called Chips.
Specifically you probably referring to a ChipGroup.
and there's a guide and some examples on how to use them here
They are rather new (might be the reason you were having trouble finding the name of what you are looking for) but they are included in the google material library so that provides support for older android versions.

How to create a GMail.app like menu

I'm new into Android programming, but making steady progress with it. My app has several activities, and I would like to add an GMail.app like menu to it.
It would be very stunning if someone could give me a hint what I should search the API docs for to create a menu like this. Thanks a lot.
If you're targeting API 11 and higher you can just use the ActionBar. If you want to provide the same UI for devices with older versions of Android as well, you can give ActionBarSherlock a try. Here's a tutorial on how to use it.
You can start off by creating a custom Menu. Read up on it here. To have your Menu look a certain way, you'll want to mess with Themes and Styles. You can find a basic tutorial on that here. Your question is somewhat broad so I can't provide specific code examples, but the links should get you on your way.
Specifically what you're looking for in this case is the ActionBar Dropdown Navigation Mode (see the ActionBar docs). Of course, this is only for API level 11 and higher since it involves the ActionBar.

Android Menu Layout Front page

I want to make a menu sort of similar to Yelps front page.
The left image in particular. I feel like I've seen this on multiple apps, and I also remember thinking that this was actually something built into the default android layouts, but I can't seem to find anything on it anywhere.
How would I go about making this layout? Is there something already built for you, or do I have to make using image buttons and a relative layout?
Google+ also uses something like this on their first page; a lot of apps do now. It's called a dashboard layout. You can see an overview of that here and an explanation of how to create it here.
Using button images and a relative layout is an easy way to do this. For help on that look at this tut: http://developer.android.com/resources/tutorials/views/hello-relativelayout.html

"Home Screen" like effect while switching between views on Android

I'm creating an application on android similar to that of a book. I would simply like to have the scrolling effect between views (not activities) similar to that of the home screen. Currently I am using a ViewFlipper and don't have the animation I would like, since the shift is sudden as opposed to following your finger.
I am aware that there are several opensource projects and classes being developed to achieve such a thing more easily for the individual programmer, but wondered if there was a way I may have overlooked to implement a homescreen-esque effect. An alternative which I have thought of using would be a TabView, with no label tabs being displayed above the content of the page, yet have not heavily looked into this option yet.
If anyone has encountered the same hurdle and has any ideas of how to overcome it, I will buy you a pizza! (Not really... I don't know your address) But I'd be very appreciative! :)
Thanks
I think you're looking for the ViewPager. It's part of the compatibility library.

Categories

Resources