android 执行到tabHost.addTab()是出现问题 下面是代码。。。。。。
publicclassMainActivityextendsTabActivity{@OverrideprotectedvoidonCreate(BundlesavedI...
public class MainActivity extends TabActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
Intent remoteIntent = new Intent();
remoteIntent.setClass(this, LocalMp3ListActivity.class);
TabHost.TabSpec remoteSpec = tabHost.newTabSpec("Remote");
Resources res = getResources();
remoteSpec.setIndicator("Remote",
res.getDrawable(android.R.drawable.stat_sys_download));
remoteSpec.setContent(remoteIntent);
System.out.println("000");
tabHost.addTab(remoteSpec);
Intent LocalIntent = new Intent();
LocalIntent.setClass(this, LocalMp3ListActivity.class);
TabHost.TabSpec LocalSpec = tabHost.newTabSpec("Local");
LocalSpec.setIndicator("Local",
res.getDrawable(android.R.drawable.stat_sys_upload));
LocalSpec.setContent(LocalIntent);
tabHost.addTab(LocalSpec);}
错误提示。。。
main.xml文件。。 展开
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
Intent remoteIntent = new Intent();
remoteIntent.setClass(this, LocalMp3ListActivity.class);
TabHost.TabSpec remoteSpec = tabHost.newTabSpec("Remote");
Resources res = getResources();
remoteSpec.setIndicator("Remote",
res.getDrawable(android.R.drawable.stat_sys_download));
remoteSpec.setContent(remoteIntent);
System.out.println("000");
tabHost.addTab(remoteSpec);
Intent LocalIntent = new Intent();
LocalIntent.setClass(this, LocalMp3ListActivity.class);
TabHost.TabSpec LocalSpec = tabHost.newTabSpec("Local");
LocalSpec.setIndicator("Local",
res.getDrawable(android.R.drawable.stat_sys_upload));
LocalSpec.setContent(LocalIntent);
tabHost.addTab(LocalSpec);}
错误提示。。。
main.xml文件。。 展开
1个回答
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询