1

I have created 3 tabs, i have some text in them however now i need to insert images as well, can anyone help me with this? I have some code in my xml document is this code useful or should i get rid of it

user123
  • 67
  • 1
  • 6

2 Answers2

0

Try tis code for TabActivity:

 TabHost  tabHost = getTabHost();
            addTab(this.getString(R.string.tabname),R.drawable.tabimage,ActivityInTab.class);

private void addTab(String title, int imageId, Class<? extends Activity> activity ){
        tabHost.setup(this.getLocalActivityManager());
        TabSpec ts = tabHost.newTabSpec("tab_"+title);
        ts.setIndicator(title,getResources().getDrawable(imageId));
        ts.setContent(new Intent(this, activity));
        tabHost.addTab(ts);        
    }
Natali
  • 2,934
  • 4
  • 39
  • 53
0

Link to example.

Like i said in the other post. Take a loot at ImageView. You will need to do some research in this. There are tons of examples on google. Use this as a reference and then try find something that will help you.

Community
  • 1
  • 1
prolink007
  • 33,872
  • 24
  • 117
  • 185