2011-06-17 30 views
1

有誰知道爲什麼這將無法正確加載。當它嘗試加載這個XML時,我在模擬器中強制退出。我正在嘗試將佈局設置爲此TabHost。我不能得到這個包含TabHost的XML在Android應用程序中正確加載

<?xml version="1.0" encoding="utf-8"?> 
<TabHost 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" android:background="#FFFFFF"> 
    <RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:padding="5dp"> 
    <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content"  android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="10px" android:layout_marginBottom="10px"> 
     <ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginRight="10px" android:src="@drawable/logo"></ImageView> 
     <LinearLayout android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:orientation="vertical" android:layout_width="wrap_content" android:layout_gravity="center"> 
      <TextView android:text="text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Text1" android:textColor="#1565BC" android:textStyle="bold"></TextView> 
      <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="text" android:id="@+id/Text2" android:textColor="#333333"></TextView> 
      <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="text" android:id="@+id/Text3" android:textColor="#333333"></TextView> 
      <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="text" android:id="@+id/Text4" android:textColor="#333333"></TextView> 
      <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="text" android:id="@+id/Text5" android:textColor="#1565BC"></TextView> 
     </LinearLayout> 
    </TableRow> 
    <TabWidget 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@android:id/tabs" android:layout_below="@+id/tableRow1" android:layout_alignLeft="@+id/tableRow1" android:layout_alignRight="@+id/tableRow1"/> 
<FrameLayout 
    android:id="@android:id/tabcontent" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    </FrameLayout> 
    </RelativeLayout> 
</TabHost> 
+0

你應該發佈你得到的異常。 – dmon

回答

0

我只是用你的佈局沒有任何麻煩可言,我唯一改變

<ImageView android:src="@drawable/mylogo"></ImageView> 

檢查提拉文件夾中的條目,這可能是問題。

+0

佈局的作品,但是當我在模擬器中運行它迫使它退出。我能否將這個佈局添加到運行2.3.3的模擬器中? TabHost是否只適用於3.0 –

+0

TabHost的鏈接http://developer.android.com/reference/android/widget/TabHost.html再次它在2.3.3工作正常 – CheGueVerra

相關問題