onkar
onkar

Reputation: 4547

Create Custom Action tab bar

I am trying to create a custom tabbar using this tutorial for android 2.3.3 and above,but the title bar is disabled(Refer the image attached app deployed on Android 2.3.3 ).

enter image description here

Also, how do I customize the titlebar. Please guide me for the same.

Upvotes: 0

Views: 231

Answers (1)

Lia Pronina
Lia Pronina

Reputation: 756

I had a similar problem. I solved it this way. Created new layout for action bar tab's title and initialized first tab like this:

// init first tab indicator
View viewTabMain = getLayoutInflater().inflate(R.layout.your_title_layout, null);
((ImageView) viewTabMain.findViewById(R.id.imgTab)).setImageResource(R.drawable.icon_1);

// add main tab
tabHost.addTab(tabHost.newTabSpec(TAB_MAIN).setIndicator(viewTabMain).setContent(new TabHost.TabContentFactory() {
@Override
public View createTabContent(String s) {
View view = new View(getApplicationContext());
return view;
}
}));

To other tab (or tabs) use the same. I hope this will help you!

Upvotes: 1

Related Questions