Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyTabApp extends TabActivity {
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- TabHost tabHost = getTabHost();
- TabHost.TabSpec spec;
- Intent intent;
- ImageView divider = new ImageView(this);
- divider.setImageResource(R.drawable.divider);
- ImageView tab_divider = new ImageView(this);
- tab_divider.setImageResource(R.drawable.divider);
- intent = new Intent().setClass(this, Page1.class);
- spec = tabHost.newTabSpec("page1").setIndicator(getLayoutInflater().inflate(R.layout.tab1, null))
- .setContent(intent);
- tabHost.addTab(spec);
- tabHost.getTabWidget().addView(divider, LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
- intent = new Intent().setClass(this, Page2.class);
- spec = tabHost.newTabSpec("page2").setIndicator(getLayoutInflater().inflate(R.layout.tab2, null))
- .setContent(intent);
- tabHost.addTab(spec);
- tabHost.getTabWidget().addView(tab_divider, LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
- intent = new Intent().setClass(this, Page3.class);
- spec = tabHost.newTabSpec("page3").setIndicator(getLayoutInflater().inflate(R.layout.tab3, null))
- .setContent(intent);
- tabHost.addTab(spec);
- tabHost.setCurrentTab(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement