tabhost的图标

TabHost tabHost = getTabHost(); 
TabHost.TabSpec spec; 
Intent intent; 
 
intent
= new Intent().setClass(this, YourClass.class); 
spec
= tabHost.newTabSpec("tab_name").setIndicator("Tab Text", 
            getResources
().getDrawable(R.drawable.ic_tab_dialer)) 
           
.setContent(intent); 
tabHost
.addTab(spec); 

ic_tab_dialer.xmlres/drawable/

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
   
<item android:state_selected="true" 
       
android:state_pressed="false" 
       
android:drawable="@drawable/ic_tab_selected_dialer" /> 
   
<item android:drawable="@drawable/ic_tab_unselected_dialer" /> 
</selector> 

你可能感兴趣的:(android,xml)