noloman
noloman

Reputation: 11965

Android: tabs within tabs

I'm currently trying to create an application according the customer's specs, and these include a double tab set.

Meaning that the user needs to click in a tab at the bottom, and for example in the first tab, he will also see a set of tabs at the top where he can click (but when clicking in these, only the ones at the top will change, while the tabs at the bottom will remain the same).

How could I perform this with Android? So far I could only implement the normal tabs creating a root item 'TabHost' just like this:

<?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" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentTop="true" >
        </FrameLayout>

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

</TabHost> 

Thanks a lot in advance!

Upvotes: 2

Views: 3450

Answers (1)

noloman
noloman

Reputation: 11965

I found this, thanks to the ActionBar (and SherlockActionBar for pre-Honeycomb devices):

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarTabs.html

and also this:

http://www.youtube.com/watch?v=gMu8XhxUBl8

Upvotes: 1

Related Questions