-2
林创建一个Android应用程序的工作室,我想,当用户在标签按钮的标签图标点击/彩色更改选项卡布局选项卡颜色?
变化,这是我的代码:
tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
int id= tabHost.getCurrentTab();
// TabLayout.setSelectedTabIndicatorColor(int color); // Error because of non static method
// if(id==0){
// TabHost.TabSpec tab1spec = tabHost.newTabSpec("List");
// tab1spec.setIndicator("", getResources().getDrawable(R.drawable.home2));
// }
// if(id==1){
// TabHost.TabSpec tab1spec = tabHost.newTabSpec("Config");
// tab1spec.setIndicator("", getResources().getDrawable(R.drawable.lab2));
// }
// if(id==2){
// TabHost.TabSpec tab1spec = tabHost.newTabSpec("More");
// tab1spec.setIndicator("", getResources().getDrawable(R.drawable.more2));
// }
}
});
任何想法?
感谢
由于它工作得很好, – Disco4uf