我这里发生了一些奇怪的事情!
我有一个 Tabhost,有 3 个选项卡。在我的模拟器中,它运行良好,来回运行。 但是在我的平板电脑(HP Touchpad 和 Samsung Galaxy Tab 1)上它不工作。我从选项卡 1 转到选项卡 2,但无法返回。当我转到 Tab 3 时,tab3 的内容卡住,我无法返回到 tab1 或 tab2(或者......至少内容没有显示它应该显示的内容(以及它在模拟器中正确显示的内容)。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainmenu);
TabHost mTabHost = (TabHost)findViewById(android.R.id.tabhost);
Intent tab1 = new Intent(this, tab1.class);
TabHost.TabSpec tab1Spec = mTabHost.newTabSpec("tab1").setIndicator("tab1").setContent(tab1);
mTabHost.addTab(tab1Spec);
// this 2 more times with my other tabs.
感谢您的帮助!我不知道我应该看哪里,如果它(以某种方式)做正确的事情:(
最佳答案
您可以使用 aLogcat ( https://play.google.com/store/apps/details?id=org.jtb.alogcat ) 查看您是否没有收到任何错误。我猜你会看到错误,可能是特定于设备的错误。
就我从您提供的代码来看,它看起来应该可以工作。
关于Android Tabhost 内容在平板电脑上卡住但在模拟器中不卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13807421/