TabHost的標籤設置

TabHost的標籤能夠包含圖片與文字,咱們能夠獲取到每一個標籤存放圖片與文字的控件,進行相關的設置java

<!-- lang: java -->
TabWidget tw = tabHost.getTabWidget(); 
for (int i = 0; i < tw.getChildCount(); i++) {     
TextView tv=(TextView)tw.getChildAt(i).findViewById(android.R.id.title);     
ImageView iv=(ImageView)tw.getChildAt(i).findViewById(android.R.id.icon); 
}

android.R.id.title與android.R.id.icon是固定的,經過這2個id能夠獲取到標籤所對應的控件android

相關文章
相關標籤/搜索