how to add images to tabs

I created tabs. Now i want to put some icons as background of that tabs. give me some sample code on that
jeesrinuAsked:
Who is Participating?
 
logicbobCommented:
If you mean to put the icons on the tabs themselves, then read:
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

If you want the images as backgrounds in the main area, in the onCreate() for a tab, put:

TextView textview = new TextView(this);
Resources res = this.getResources();
Drawable myImage = res.getDrawable(R.drawable.myimage);
textview.setBackgroundDrawable(myImage);
setContentView(textview);

where your image "myimage" is put in the drawable resource folder.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.