0
点赞
收藏
分享

微信扫一扫

动态更换tab indicator


初始化

tabHost = getTabHost();  
TabSpec tabSpec = tabHost.newTabSpec("abc"); 
tabSpec.setIndicator("helloabc"); 
tabSpec.setContent(new MyViewFactory()); 
tabHost.addTab(tabSpec);

我想动态更换为

TabSpec tabSpec = MyTabActivity.getTabSpec(); 
tabSpec.setIndicator("xyz");


可是上面的方法不好用


要想修改需要用:

TextView title = (TextView) tabHost.getTabWidget().getChildAt(tabId).findViewById(android.R.id.title) 
title.setText("xyz");

举报

相关推荐

0 条评论