Android – iPhone like Tab bar in Android

By -

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:

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 changed the RelativeLayout and set the android:layout_alignParentBottom=”true” in TabWidget so that it will be displayed at down side.

Paresh Mayani

Lazy android developer, exploring the horizon of android development since 5 years. He is Senior Software engineer at InfoStretch Solutions Pvt. Ltd. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad

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