2012-07-29 133 views
0

大家好我是新来的Android开发.. 在我的应用我想因为这样的形象,显示布局:Android应用程序的布局问题

enter image description here
但我得到这个图片来代替:

http://www.freeimagehosting.net/newuploads/7aqo7.jpg

这里是我的代码: - http://www.freefilehosting.net/bookingform_1

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 
<TableLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/bg" > 
    <TableRow 
     android:id="@+id/tableRow1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 
     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/BookingFormRoomLabel" 
      android:textColor="@android:color/white" /> 
     <Spinner 
      android:id="@+id/roomspinner" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
    </TableRow> 
    <TableRow 
     android:id="@+id/tableRow2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 
     <TextView 
      android:id="@+id/textView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/BookingFormDocTypeLabel" 
      android:textColor="@android:color/white" /> 
     <Spinner 
      android:id="@+id/DocTypeSpinner" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
    </TableRow> 
    <TableRow 
     android:id="@+id/tableRow3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 
     <TextView 
      android:id="@+id/textView3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/BookingFormAdultsLabel" 
      android:textColor="@android:color/white" /> 
     <Spinner 
      android:id="@+id/AdultsSpinner" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
    </TableRow> 
    <TableRow 
     android:id="@+id/tableRow4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 
     <TextView 
      android:id="@+id/textView4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/BookinFormChildrensLabel" 
      android:textColor="@android:color/white" /> 
     <Spinner 
      android:id="@+id/ChildrensSpinner" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
    </TableRow> 
    <TableRow 
     android:id="@+id/tableRow5" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 
     <TextView 
      android:id="@+id/textView5" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/BookingFormNightsLabel" 
      android:textColor="@android:color/white" /> 
     <Spinner 
      android:id="@+id/NightSpinner" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
    </TableRow> 
    <TableRow 
     android:id="@+id/tableRow6" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 
     <TabHost 
      android:id="@android:id/tabhost" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="1"> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" > 
       <TabWidget 
        android:id="@android:id/tabs" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" > 
       </TabWidget> 
       <FrameLayout 
        android:id="@android:id/tabcontent" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" > 
        <LinearLayout 
         android:id="@+id/tab1" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" > 
         <TableRow 
          android:id="@+id/tableRow7" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_span="2" > 
          <ImageView 
           android:id="@+id/MainImageView" 
           android:layout_width="200dp" 
           android:layout_height="200dp" 
           android:layout_weight="1" 
           android:contentDescription="@string/BookingFormMainImage" 
           android:src="@drawable/documentsample" /> 
          <Button 
           android:id="@+id/button1" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:text="Button" /> 

          <Button 
           android:id="@+id/button2" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:gravity="center_vertical" 
           android:text="Button" /> 

         </TableRow> 
         </LinearLayout> 
         <LinearLayout 
         android:id="@+id/tab2" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" > 
         <ImageView 
          android:id="@+id/SubImageView" 
          android:layout_width="200dp" 
          android:layout_height="200dp" 
          android:contentDescription="@string/BookingFormSubImage" 
          android:src="@drawable/documentsample" /> 
         <Button 
          android:id="@+id/BtnSubImageCapture" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:gravity="right" 
          android:text="@string/BtnBookingFormSubImageCapture" /> 
         <Button 
          android:id="@+id/BtnSubImageBrowse" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:gravity="right|center" 
          android:text="@string/BtnBookingFormSumbImageBrowse" /> 
         <Button 
          android:id="@+id/BtnSubImageDelete" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:gravity="right|center_vertical|center" 
          android:text="@string/BtnBookingFormSubImageDelete" /> 
         </LinearLayout> 
         </FrameLayout> 
      </LinearLayout> 
     </TabHost> 
     </TableRow> 

+2

你能张贴您的布局代码,请 – 2012-07-29 12:46:30

+0

一次检查中,按钮位于您的布局方向上..改变方向垂直.. – 2012-07-29 12:52:20

回答

0

只需多加一个LinearLayout保持布局orientationvertical并保持这些按钮在这一布局。

<LinearLayout 
    android:id="@+id/tab2" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 
    <ImageView 
     android:id="@+id/SubImageView" 
     android:layout_width="200dp" 
     android:layout_height="200dp" 
     android:contentDescription="@string/BookingFormSubImage" 
     android:src="@drawable/documentsample" /> 
     <LinearLayout 
      android:id="@+id/buttons_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" > 
      <Button 
       android:id="@+id/BtnSubImageCapture" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="right" 
       android:text="@string/BtnBookingFormSubImageCapture" /> 
      <Button 
       android:id="@+id/BtnSubImageBrowse" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="right|center" 
       android:text="@string/BtnBookingFormSumbImageBrowse" /> 
      <Button 
       android:id="@+id/BtnSubImageDelete" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:gravity="right|center_vertical|center" 
       android:text="@string/BtnBookingFormSubImageDelete" /> 
      <LinearLayout/> 
     </LinearLayout> 
+0

这里是我的代码http://www.freefilehosting.net/bookingform_1 – Rakesh 2012-07-29 12:56:59

+0

刚过去你的代码有问题..什么是这个链接.. – 2012-07-29 13:00:49

+0

好吧现在我发布.. :-) – Rakesh 2012-07-29 13:06:12