我想在TabActivity中添加三个布局,但是当我运行时它被强制关闭。
import android.app.TabActivity; import android.content.res.Resources; import android.os.Bundle; import android.widget.TabHost;
公共类Test1扩展了TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources();
TabHost tabHost = getTabHost();
tabHost.addTab(tabHost.newTabSpec("egcquery").setIndicator("EGCQuery").setContent(R.layout.main1));
tabHost.addTab(tabHost.newTabSpec("PatientInfo").setIndicator("PatientInfo").setContent(R.layout.main2));
tabHost.addTab(tabHost.newTabSpec("Comp_Interp").setIndicator("Comp_Interp").setContent(R.layout.main3));
}
}
答案 0 :(得分:0)