I want to set a background image for each tab in my application. I tried applying a icon but it wont fill the tabs. Then I tried putting a layout. It covers the all height but width isn't enough.
Below is my code Please help to fill a tab with a background image.
viewpager = (ViewPager) findViewById(R.id.pager);
FragmentPageAdapter ft = new FragmentPageAdapter(getSupportFragmentManager(), getApplicationContext());
actionBar = getActionBar();
viewpager.setAdapter(ft);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.addTab(actionBar.newTab().setCustomView(R.layout.a_selected).setTabListener(this)); // trying to apply a layout as background
actionBar.addTab(actionBar.newTab().setIcon(R.drawable.icon_1).setTabListener(this));//applying a icon as background
actionBar.addTab(actionBar.newTab().setIcon(R.drawable.icon_2).setTabListener(this));//applying a icon as background