Android – iPhone like Tab bar in Android

By -



Hi,

If you have gone through my previous article to Display Tab Bar in android, where we have just seen the simple Tab bar display process as per the Android way. But what if we want to display iPhone Like tab bar in Android(i.e. Displaying Tab bar at bottom side in Android). Is it possible? yes, it is possible and check the below image for the same:

Android - Tab bar at bottom side

Android - Tab bar at bottom side

In my previous Tab bar example, just change the main.xml file as below, and then you will be having a tab bar at down side.

main.xml

<?xml version="1.0" encoding="utf-8"?>
<TabHost
	android:id="@android:id/tabhost"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	xmlns:android="http://schemas.android.com/apk/res/android">

	<RelativeLayout
		android:layout_width="match_parent"
		android:id="@+id/linearLayout1"
		android:layout_height="match_parent">

		<TabWidget
			android:layout_width="match_parent"
			android:layout_height="wrap_content"
			android:id="@android:id/tabs"
			android:layout_alignParentBottom="true">
		</TabWidget>

		<FrameLayout
			android:layout_width="match_parent"
			android:layout_height="match_parent"
			android:id="@android:id/tabcontent">
		</FrameLayout>
	</RelativeLayout>
</TabHost>

FYI, i have just change the RelativeLayout and set the android:layout_alignParentBottom=”true” in TabWidget so that it will be displayed at down side.



Paresh Mayani

Paresh Mayani is a lead android developer from India. Currently, He is Sr. Software engineer at InfoStretch Solutions Pvt. Ltd. He has been developing android apps since very 1st version i.e. Android 1.5, he says he has seen days and nights of Android history. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad

Loading Facebook Comments ...
Loading Disqus Comments ...