2011-08-01 12 views
2

タブを作成するカスタムタブインジケータがあります。しかし、私はタブの下の下の境界線を削除したい。単一の黒線とグレースケールの影の両方。私はグレースケールのフェードを生成しているのかどうかも分かりません。たぶんTabWidget、FrameLayout、または子のLinearLayoutです。参考のためグレースケールを削除するTabWidgetの枠線/辺

enter image description here

、私は(偽)setStripEnabled試みました。 もう一つの潜在的な難しさは、レイアウトファイルを使用するのではなく、TabHost & TabWidgetをプログラムで作成することです。

答えて

2

タブを使用すると、通常はアンドロイドの視認性をなくしてtabwidgetタグを非表示にします。

そして

<?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">  
     <FrameLayout android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" android:layout_height="0dip" 
      android:layout_weight="1.0"/> 
     <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:background="@drawable/ic_tab_artists" 
        android:id="@+id/artist_id" android:onClick="tabHandler"/> 
       <Button android:layout_height="fill_parent" android:layout_width="0dip" 
        android:layout_weight="1.0" 
        android:background="@drawable/ic_tab_artists" 
        android:id="@+id/album_id" android:onClick="tabHandler"/> 
       <Button android:layout_height="fill_parent" android:layout_width="0dip"  
        android:layout_weight="1.0" 
        android:background="@drawable/ic_tab_artists" 
        android:id="@+id/song_id" android:onClick="tabHandler"/> 
      </LinearLayout> 
     </FrameLayout> 
    </LinearLayout> 
</TabHost> 

などのタブボタンとして機能するボタンを追加し、私はこれは、すべての行とグレースケールを削除する必要があります

public void tabHandler(View target){ 
    artistButton.setSelected(false); 
    albumButton.setSelected(false); 
    songButton.setSelected(false); 
    if(target.getId() == R.id.artist_id){ 
     tabHost.setCurrentTab(0); 
     artistButton.setSelected(true); 
    } else if(target.getId() == R.id.album_id){ 
     tabHost.setCurrentTab(1); 
     albumButton.setSelected(true); 
    } else if(target.getId() == R.id.song_id){ 
     tabHost.setCurrentTab(2); 
     songButton.setSelected(true); 
    } 
} 

ボタンのクリックハンドラを追加します。

関連する問題