【发布时间】:2012-03-10 12:33:12
【问题描述】:
您好,我的标签小部件中有两个标签,我想为两个标签应用两种不同的颜色。我到处搜索,应用标签时几乎所有颜色都相同。
更新
first tab when selected red color
second tab when selected blue color
这是我的代码
tabHost = (TabHost)findViewById(android.R.id.tabhost);
TabSpec firstTabSpec = tabHost.newTabSpec("tid1");//these are color red
TabSpec secondTabSpec = tabHost.newTabSpec("tid1");//these color blue
firstTabSpec.setIndicator("Sales Info",getResources().getDrawable(R.drawable.sales));
Intent photosIntent = new Intent(this, a.class);
firstTabSpec.setContent(photosIntent);
secondTabSpec.setIndicator("Service Info",getResources().getDrawable(R.drawable.services));
Intent photosIntent1 = new Intent(this, b.class);
secondTabSpec.setContent(photosIntent1);
tabHost.addTab(firstTabSpec);
tabHost.addTab(secondTabSpec);
【问题讨论】: