0

我是 Android 新手,我一直在尝试重用 Android 开发者网站上关于开发 TabActivity 应用程序的教程,但不幸的是,它从未奏效,即使我以与描述完全相同的方式构建它……使用调试器似乎问题来自主要布局。

-> setContentView(R.layout.main); //After this line the app stops.

这是我的 main.xml:

<?xml version="1.0" encoding="utf-8"?>
<TabHost 
 xmlns:android="http://schemas.android.com/apk/res/android"    
 android:id="@android:id/tabhost"   
 android:layout_width="fill_parent"    
 android:layout_height="fill_parent">    
 <LinearLayout        
  android:orientation="vertical"        
  android:layout_width="fill_parent"        
  android:layout_height="fill_parent"        
  android:padding="5dp">        
  <TabWidget            
   android:id="@android:id/tabs"            
   android:layout_width="fill_parent"            
   android:layout_height="wrap_content" />        
  <FrameLayout            
   android:id="@android:id/tabcontent"            
   android:layout_width="fill_parent"            
   android:layout_height="fill_parent"            
   android:padding="5dp" />    
 </LinearLayout>
</TabHost>

如果有人有同样的问题,或者如果有人有一些建议,欢迎他们:)

坦克很多!

兰迪

4

1 回答 1

1

您发布的 xml 与TabHost 示例相同,没有任何问题。你的代码中一定有一些东西。

请发布代码,否则我们无法帮助您。

于 2010-11-17T10:05:12.583 回答