public class MainActivity extends Activity { @OverrIDe protected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_main); TabHost tabHost=(TabHost)findVIEwByID(R.ID.tabHost); tabHost.setup(); TabSpec spec1=tabHost.newTabSpec("Tab 1"); spec1.setContent(R.ID.tab1);`enter code here` spec1.setIndicator("Tab 1",getResources().getDrawable(setBackgroundcolor(color.RED)); TabSpec spec2=tabHost.newTabSpec("Tab 2"); spec2.setIndicator("Tab 2",getResources().getDrawable(setBackgroundcolor(color.GREAN)); spec2.setContent(R.ID.tab2); TabSpec spec3=tabHost.newTabSpec("Tab 3"); spec3.setIndicator("Tab 3",getResources().getDrawable(setBackgroundcolor(color.BLACK)); spec3.setContent(R.ID.tab3); tabHost.addTab(spec1); tabHost.addTab(spec2); tabHost.addTab(spec3); }}@H_419_4@解决方法
public class MainActivity extends Activity { @OverrIDe protected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_main); TabHost tabHost=(TabHost)findVIEwByID(R.ID.tabHost); tabHost.setup(); TabSpec spec1=tabHost.newTabSpec("Tab 1"); spec1.setContent(R.ID.tab1);`enter code here` spec1.setIndicator("Tab 1",getResources().getDrawable(setBackgroundcolor(vIEw.color.RED)); TabSpec spec2=tabHost.newTabSpec("Tab 2"); spec2.setIndicator("Tab 2",getResources().getDrawable(setBackgroundcolor(vIEw.color.GREAN)); spec2.setContent(R.ID.tab2); TabSpec spec3=tabHost.newTabSpec("Tab 3"); spec3.setIndicator("Tab 3",getResources().getDrawable(setBackgroundcolor(vIEw.color.BLACK)); spec3.setContent(R.ID.tab3); tabHost.addTab(spec1); tabHost.addTab(spec2); tabHost.addTab(spec3); }}@H_419_4@ @H_419_4@ @H_419_4@ @H_419_4@ 总结
以上是内存溢出为你收集整理的如何在Android中设置标签视图指示器背景颜色全部内容,希望文章能够帮你解决如何在Android中设置标签视图指示器背景颜色所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)