2012-12-10 41 views
-1

我想製作一個按鈕頂部的標籤主機的佈局。我怎樣才能做到這一點?給我這個錯誤:「在根元素之後的文檔中的標記必須是格式良好的」tabhost上的Android添加按鈕

+0

向我們展示您的XML佈局。聽起來就像你缺少標籤。 – 323go

回答

0

我發現如何添加它。

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> 
<TableLayout android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
    <TableRow 
     android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
<Button android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/btnGarsonCagir" 
    android:text="GARSON ÇAĞIR" 
    android:layout_weight="1"/> 
<Button android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/btnTaksiCagir" 
    android:text="TAKSİ ÇAĞIR" 
    android:layout_weight="1"/> 
    <Button android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/btnHesapIste" 
    android:text="HESAP İSTE" 
    android:layout_weight="1"/> 
    <Button android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/btnSepet" 
    android:text="SEPETİM" 
    android:layout_weight="1"/> 
    </TableRow> 
    </TableLayout> 

<TabHost 
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"> 
    <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"/> 
</LinearLayout>  
</TabHost> 
</LinearLayout> 
0

這是我的代碼感謝helphing。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"> 
    <TableLayout android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <TableRow 
     android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 
    <Button android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/btn" 
    android:text="osman"/> 
    </TableRow> 
    </TableLayout> 
<TableLayout android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <TableRow 
     android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

<TabHost 
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"> 
    <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"/> 
</LinearLayout>  
</TabHost> 
</TableRow> 
</TableLayout> 

</LinearLayout>