Tutorial :iPhone- like tab bar in Android?



Question:

In iPhone we can create a view that has a tab bar and make it the root view of the application then use the tab bar to navigate through sub views.

what is the most close approach to this in Android?

Is it to use a Tabbed Control? but this includes using just one activity.

what is the approach to use in Android to create an activity with a navigation control to other activities in a way similar to that of the iPhone?


Solution:1

There's a tutorial for creating a "Tab Layout" on the android dev site:

You can implement your tab content in one of two ways: use the tabs to swap Views within the same Activity, or use the tabs to change between entirely separate activities

Tab Layout http://developer.android.com/resources/tutorials/views/images/hello-tabwidget.png


Solution:2

Sorry, I really don't know the iPhone, but may a QuickAction Dialog help you??

http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/

I imagine a list of some activities in that dialog.

I hope this is close to what you want.


Solution:3

There are a couple of examples around

http://www.anddev.org/code-snippets-for-android-f33/iphone-tabs-for-android-t14678.html

This one is scrollable http://code.google.com/p/mobyfactory-uiwidgets-android/


Solution:4

<?xml version="1.0" encoding="utf-8"?>  <TabHost xmlns:android="http://schemas.android.com/apk/res/android"   android:id="@android:id/tabhost"   android:layout_width="fill_parent"   android:layout_height="fill_parent"  >  <LinearLayout  android:orientation="vertical"  android:layout_width="fill_parent"  android:layout_height="fill_parent"          android:layout_marginBottom="0dp"   >      <FrameLayout      android:id="@android:id/tabcontent"      android:layout_width="fill_parent"      android:layout_height="wrap_content"                  android:layout_weight="1"       />        <TabWidget      android:id="@android:id/tabs"      android:layout_width="fill_parent"      android:layout_height="wrap_content"      android:layout_weight="0"     />  </LinearLayout>  </TabHost>  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »