android - tabs: custom bg color and text position -



android - tabs: custom bg color and text position -

simple question (i guess). have default google tutorial code tabs:

intent = new intent().setclass(this, about.class); spec = tabhost.newtabspec("albums").setindicator("about") .setcontent(intent); tabhost.addtab(spec); (int = 0; < tabhost.gettabwidget().gettabcount(); i++) { tabhost.gettabwidget().getchildat(i).getlayoutparams().height = 50; }

and wondering - possible alter text position , (or) background adding lines of code existing piece, not starting on again? thanks!

so yeah: text position , custom background (html color). how do it? thanks!

p.s please don't start droping links other tutorials, it's kinda hard me understand those. :/

i found code looking for. here's total code of tabs.java activity:

package com.xjcdi.name; import com.xjcdi.exploringvilnius.r; public class tabs extends tabactivity implements ontabchangelistener { tabhost tabhost; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.tabs); tabhost = (tabhost)findviewbyid(android.r.id.tabhost); tabhost.setontabchangedlistener(this); resources res = getresources(); // resource object drawables tabhost tabhost = gettabhost(); // activity tabhost tabhost.tabspec spec; // reusable tabspec each tab intent intent; // reusable intent each tab // create intent launch activity tab (to reused) intent = new intent().setclass(this, places.class); // initialize tabspec each tab , add together tabhost spec = tabhost.newtabspec("artists").setindicator("places") .setcontent(intent); tabhost.addtab(spec); (int = 0; < tabhost.gettabwidget().gettabcount(); i++) { tabhost.gettabwidget().getchildat(i).getlayoutparams().height = 50; } for(int i=0;i<tabhost.gettabwidget().getchildcount();i++) // same other tabs intent = new intent().setclass(this, about.class); spec = tabhost.newtabspec("albums").setindicator("about") .setcontent(intent); tabhost.addtab(spec); (int = 1; < tabhost.gettabwidget().gettabcount(); i++) { tabhost.gettabwidget().getchildat(i).getlayoutparams().height = 50; } intent = new intent().setclass(this, artistai.class); spec = tabhost.newtabspec("songs").setindicator("map") .setcontent(intent); tabhost.addtab(spec); (int = 2; < tabhost.gettabwidget().gettabcount(); i++) { tabhost.gettabwidget().getchildat(i).getlayoutparams().height = 50; } intent = new intent().setclass(this, map.class); spec = tabhost.newtabspec("songs").setindicator("history") .setcontent(intent); tabhost.addtab(spec); (int = 3; < tabhost.gettabwidget().gettabcount(); i++) { tabhost.gettabwidget().getchildat(i).getlayoutparams().height = 50; } tabhost.setcurrenttab(0); } @override public void ontabchanged(string tabid) { // todo auto-generated method stub for(int i=0;i<tabhost.gettabwidget().getchildcount();i++) { tabhost.gettabwidget().getchildat(i).setbackgroundcolor(color.parsecolor("#000000")); } tabhost.gettabwidget().getchildat(tabhost.getcurrenttab()).setbackgroundcolor(color.parsecolor("#c1902d")); } }

android colors tabs position

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -