user1378110
user1378110

Reputation: 11

Customize tabs android

This is how I want the tabs to look:

http://img14.imageshack.us/img14/5696/tabort.png

This is how they look using tabHost:

http://img684.imageshack.us/img684/1030/tabort2.png

So I want to remove the border around the images. Instead, I want to have the greyish background image behind the tabs. Can anyone please help me with this (I'm new to Android)?

Here is some relevant code:

// Create an Intent to launch an Activity for the tab 
    intent = new Intent().setClass(this, WashActivity.class);

    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabHost.newTabSpec("washer").setIndicator("",
                      res.getDrawable(R.drawable.wash_tab))
                  .setContent(intent);
    tabHost.addTab(spec);

Upvotes: 0

Views: 537

Answers (2)

Shailendra Singh Rajawat
Shailendra Singh Rajawat

Reputation: 8242

set custom view ( imageview or image with text in ur case ) using setView() instead setIndicator() will work for you .

TabHost is deprecated now . so better to use fragment with compatibility package .

Upvotes: 1

Gaurav Agarwal
Gaurav Agarwal

Reputation: 19102

You can use Buttons positioned side-by-side in Relative Layout with custom background images instead of TabView.

Upvotes: 1

Related Questions