Android change background of tabs -
does know how can edit tabs background have red gradient background when not selected , when selected dark red gradient? change text color white?
you can use code
tabhost.tabspec spec; tabhost tabhost = gettabhost(); spec = tabhost.newtabspec("1").setindicator("tab host 1", res.getdrawable(r.drawable.xxx)).setcontent(intent_name); tabhost.addtab(spec); tabhost.setcurrenttab(2); settabcolor(tabhost); tabhost.setontabchangedlistener(new ontabchangelistener() { @override public void ontabchanged(string tabid) { settabcolor(tabhost); } }); } public static void settabcolor(tabhost tabhost) { (int = 0; < tabhost.gettabwidget().getchildcount(); i++) { tabhost.gettabwidget().getchildat(i).setbackgroundcolor(color.parsecolor("#000000")); // unselected } tabhost.gettabwidget().getchildat(tabhost.getcurrenttab()).setbackgroundcolor(color.parsecolor("#74df00")); // selected }
Comments
Post a Comment