2011-07-26 7 views
0

タブホストの各タブウィジェットに画像を設定する必要があります。 Iはhost.addTab(host.newTabSpec( "AAA") .setIndicator( "A"、getResources()getDrawable(R.drawable.my_tabselector))を使用して画像を設定し;tabhostのタブに画像(テキストなし)のみを設定する方法android 1.6

それはに適合しませんタブ(タブwigetが私のイメージよりも大きい)

plase私を助けてくれてありがとう

答えて

1

はタブは画像のみを持たせるために、これを行います。。

tabHost.addTab(tabHost.newTabSpec("aaa").setIndicator("", getResources().getDrawable(R.drawable.my_tabselector)).setContent(R.id.my_tab_contentlayout)); 
+0

内部の任意のテキストを書いていません。私の問題を解決する。 – rwe

0

あなたはこのように、TIハイトタブを使用することができますタイトル:

for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) 
    { 
     View view = tabHost.getTabWidget().getChildAt(i); 
     view.findViewById(android.R.id.title).setVisibility(View.GONE); 
    } 
0
 TabHost tabHost = getTabHost(); 

     Intent intent; 

     intent = new Intent(MainActivity.this, SecondActivity.class); 

     tabHost.addTab(tabHost.newTabSpec("").setIndicator("", getResources().getDrawable(R.drawable.home_selected)).setContent(intent)); 

     intent = new Intent(MainActivity.this, Calendar.class); //2 

     tabHost.addTab(tabHost.newTabSpec("").setIndicator("",getResources().getDrawable(R.drawable.calender_unselect)).setContent(intent)); 

非常host.getTabWidget()getChildAt(1).setBackgroundResource(R.drawable.myimage)のuをありがとうsetIndicator("Tab text", getResource(). ...)

関連する問題