Reputation: 1291
How do I make a tabview so that the tabs are a bit transparent so that you can see the content of a Listview being hosted by the tabview?
So far I tried making the tabs/buttons transparent by setting the alpha, but I think that the way the Tabhost is made there isn't anything behind the buttons, so making it transparent will only show a black background
Thanks!
Upvotes: 1
Views: 1529
Reputation: 31789
You can hide the tab widget. And use buttons
<?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">
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/header">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="woopra" android:textColor="#ffffff" android:textSize="36sp"
android:textStyle="bold"/>
</LinearLayout>
<FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:visibility="gone"/>
<LinearLayout android:layout_width="fill_parent" android:layout_height="64dip">
<Button android:layout_height="fill_parent" android:layout_width="0dip"
android:layout_weight="1.0" android:id="@+id/dashboard_tab"
android:onClick="tabHandler" android:text="Dashboard"/>
<Button android:layout_height="fill_parent" android:layout_width="0dip"
android:layout_weight="1.0" android:id="@+id/visitors_tab"
android:onClick="tabHandler" android:text="Vistors"/>
<Button android:layout_height="fill_parent" android:layout_width="0dip"
android:layout_weight="1.0" android:id="@+id/chat_tab" android:onClick="tabHandler"
android:text="Chat"/>
<Button android:layout_height="fill_parent" android:layout_width="0dip"
android:layout_weight="1.0" android:id="@+id/reports_tab"
android:onClick="tabHandler" android:text="Reports"/>
</LinearLayout>
</FrameLayout>
<FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="0dip"
android:layout_weight="1.0"/>
</LinearLayout>
Here Ive used 4 buttons instead of the tabwidget. And in the button's onclick I use something like tabHost.setCurrentTab(1);
Setting alpha to the buttons should work.
Upvotes: 1