2011-08-10 11 views
1

私は4つのタブを持つ単純なtabControllerを持っていますが、アイコン画像がタブ全体を占めるようにしたいと思います。私はまた、アイコンの上にタブのテキストが必要です。私はちょうど正しい方向に行くためにいくつかのヒントが必要です。Androidタブアイコン画像のフルサイズ

私のタブの画像が表示されません(レピュテーションポイントが不十分です)。しかし、基本的に私はタブのアイコンの周りのすべてのパディングに乗る必要があります。

私のアイコンはpngファイルです。私tabControllerViewはTabActivityを延長していると私はtab_layout.xml使用しています:私は私のtabControllerViewののonCreateでこれをやっている各タブについて

<?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" 
      > 
      <TabWidget 
       android:id="@android:id/tabs"    
       android:layout_width="fill_parent"    
       android:layout_height="wrap_content" /> 
      <FrameLayout    
       android:id="@android:id/tabcontent"    
       android:layout_width="fill_parent"    
       android:layout_height="fill_parent"    
       />  
    </LinearLayout> 
</TabHost> 

を:

spec = tabHost.newTabSpec("home").setIndicator("Home", 
res.getDrawable(R.drawable.ic_tab_home)).setContent(intent); 
    tabHost.addTab(spec); 

答えて

1

あなたはでそれを行うことができるはずですこのようなもの:

 for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++){ 
      tabHost.getTabWidget().getChildAt(i).setPadding(0,0,0,0); 
     } 
関連する問題