Can't set background for TabWidget android

245 Views Asked by At

enter image description here

I searched a lot but could not find specific solution for my problem. I am posting a screen shot where you can see a tab widget. Also there is an exclamation mark there don't know why! You can see on the right bottom corner there is Background set to drawable. I have put the same named drawable into x,m,l,s, dpi folders. Also you can see in the Screen shot that there is API 8 used. Now the problem that I am facing is I can see the background set for 4.0 but not for 2.2! I have used setBackgroundResource also in class file, I tried to set alpha 0 for this tabwidget also. But don't know why its not taking my image as its Bg for API 8!! Thanks all would appreciate any relevant help.

1

There are 1 best solutions below

0
On

i did try it like you and same result.. with normal tabhost on api 8.

But finally i did download : http://code.google.com/p/android-custom-tabs/downloads/detail?name=customized-tabs.zip&can=2&q=

And as sample edit tab_bg_unselected.xml change it to transparent instead of that gradient.

put a solid element with android:color @android:color/transparent and it would be transparent after.

Then set a backgroundimage to the tabhost and its working nice.

Author article is : http://joshclemm.com/blog/?p=136

I think this is a very good solution and you could even make greater customization with that one.

Its a nice workarround, hope you could like it :)

Here a screenshot on a real 2.2.1 Motorola Milestone Android 2.2.1

Note : Did even verify it on latest Nexus 7 4.3 tablet and S2 4.1.2