2011-09-23 49 views
1

如何製作tabview,使標籤有點透明,以便您可以看到由tabview託管的Listview的內容?如何使製表符中的標籤透明

到目前爲止,我試圖通過設置阿爾法使得標籤/按鈕透明的,但我認爲 的Tabhost製成的方式沒有按鈕後面任何東西,所以使得它 透明意志只顯示黑色背景

謝謝!

回答

1

您可以隱藏標籤小部件。並使用按鈕

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

這裏我使用了4個按鈕而不是tabwidget。並在按鈕的onclick我使用 類似 tabHost.setCurrentTab(1);

設置按鈕的alpha應該工作。