请问不同activity在同一个tab里面如何相互跳转?
------解决方案--------------------
TabHost tabHost = getTabHost();
TabHost.TabSpec spec1 = tabHost.newTabSpec("tab1");
spec1.setIndicator("名称");
spec1.setContent(new Intent(this, 你需要跳转的activity.class));
tabHost.addTab(spec1);
------解决方案--------------------
这是以前写的一段代码:
- Java code
TabHost tabHost = getTabHost(); LayoutInflater.from(this).inflate(R.layout.main, tabHost.getTabContentView(), true); tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("设置") .setContent(R.id.tab1)); Intent i = new Intent(); i.setClass(this, GPSTest.class); i.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP); tabHost.addTab(tabHost.newTabSpec("tab2").setIndicator("信号") .setContent(i));
------解决方案--------------------