2016-02-29 41 views
0

我用下面的代碼來創建視圖滾動型拋出一個錯誤消息

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/scrollView" > 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="PI 12343" 
       android:id="@+id/proformo" 
       android:layout_marginTop="20dp" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"/> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="Cargo Shipped" 
        android:layout_marginLeft="20dp" 
        android:id="@+id/shippingStatus" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="on07 oct 2015" 
        android:id="@+id/shippingDate" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="PI 12345" 
        android:id="@+id/invoiceNumber" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="on Dec 2016" 
        android:id="@+id/invoiceDate" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="Shipment Reference No :" 

        android:id="@+id/shipment_ref_no_label" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="4312412412" 
        android:id="@+id/shipment_ref_no_value" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="ETD:" 
        android:id="@+id/etdLabel" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="24 oct 2015" 
        android:id="@+id/etdValue" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="ETA:" 
        android:id="@+id/etaLabel" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="09 dec 2014" 
        android:id="@+id/etaValue" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_marginLeft="20dp" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="8dp"> 

       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/imageView4" 
        android:src="@drawable/ic_launcher" 
        android:layout_marginRight="10dp" 
        android:layout_weight="1"/> 

       <LinearLayout 
        android:orientation="vertical" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="BioMass Pellets" 
         android:id="@+id/productName" /> 

        <LinearLayout 
         android:orientation="horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="Quantity: " 
          android:id="@+id/quantity_label" /> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="40mts" 
          android:id="@+id/quantity_value" /> 
        </LinearLayout> 

        <LinearLayout 
         android:orientation="horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="Amount: " 
          android:id="@+id/amount_label" /> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="200 USD" 
          android:id="@+id/amount_value" /> 
        </LinearLayout> 

        <LinearLayout 
         android:orientation="horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="Quantity: " 
          android:id="@+id/rate_label" /> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="40 USD" 
          android:id="@+id/rate_value" /> 


        </LinearLayout> 

       </LinearLayout> 

      </LinearLayout> 

     </LinearLayout> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="#000000" /> 

    </ScrollView> 
</LinearLayout> 

我想要的ViewGroup中顯示人textviews後劃清界限。我面臨的問題是它會拋出一個錯誤,說scrollview can have only one direct child。但我試圖在最後畫線。怎麼做?當我在模擬器上運行它時,我的圖像視圖也不可見。

+0

總結意見的的LinearLayout裏面所以滾動型只具有的LinearLayout作爲直接孩子。 –

回答

1

試試這個

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout    
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/scrollView" > 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:text="PI 12343" 
      android:id="@+id/proformo" 
      android:layout_marginTop="20dp" 
      android:layout_marginLeft="20dp" 
      android:layout_marginBottom="8dp"/> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="8dp"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="Cargo Shipped" 
       android:layout_marginLeft="20dp" 
       android:id="@+id/shippingStatus" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="on07 oct 2015" 
       android:id="@+id/shippingDate" /> 
     </LinearLayout> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="20dp" 
      android:layout_marginBottom="8dp"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="PI 12345" 
       android:id="@+id/invoiceNumber" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="on Dec 2016" 
       android:id="@+id/invoiceDate" /> 
     </LinearLayout> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="20dp" 
      android:layout_marginBottom="8dp"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="Shipment Reference No :" 

       android:id="@+id/shipment_ref_no_label" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="4312412412" 
       android:id="@+id/shipment_ref_no_value" /> 
     </LinearLayout> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="20dp" 
      android:layout_marginBottom="8dp"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="ETD:" 
       android:id="@+id/etdLabel" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="24 oct 2015" 
       android:id="@+id/etdValue" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="ETA:" 
       android:id="@+id/etaLabel" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="09 dec 2014" 
       android:id="@+id/etaValue" /> 
     </LinearLayout> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_marginLeft="20dp" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="8dp"> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/imageView4" 
       android:src="@drawable/ic_launcher" 
       android:layout_marginRight="10dp" 
       android:layout_weight="1"/> 

      <LinearLayout 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="BioMass Pellets" 
        android:id="@+id/productName" /> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="Quantity: " 
         android:id="@+id/quantity_label" /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="40mts" 
         android:id="@+id/quantity_value" /> 
       </LinearLayout> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="Amount: " 
         android:id="@+id/amount_label" /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="200 USD" 
         android:id="@+id/amount_value" /> 
       </LinearLayout> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="Quantity: " 
         android:id="@+id/rate_label" /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="40 USD" 
         android:id="@+id/rate_value" /> 


       </LinearLayout> 

      </LinearLayout> 

     </LinearLayout> 
     <View 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="#000000" /> 
    </LinearLayout> 
    </ScrollView> 
    </LinearLayout> 
0

這是你的代碼:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/scrollView" 
     android:paddingButtom="10dp" 
     android:background="#000000"> 
     <LinearLayout 
      android:orientation="vertical" 
      android:background="#ffffff" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="PI 12343" 
       android:id="@+id/proformo" 
       android:layout_marginTop="20dp" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"/> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="Cargo Shipped" 
        android:layout_marginLeft="20dp" 
        android:id="@+id/shippingStatus" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="on07 oct 2015" 
        android:id="@+id/shippingDate" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="PI 12345" 
        android:id="@+id/invoiceNumber" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="on Dec 2016" 
        android:id="@+id/invoiceDate" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="Shipment Reference No :" 

        android:id="@+id/shipment_ref_no_label" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="4312412412" 
        android:id="@+id/shipment_ref_no_value" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="ETD:" 
        android:id="@+id/etdLabel" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="24 oct 2015" 
        android:id="@+id/etdValue" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="ETA:" 
        android:id="@+id/etaLabel" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="09 dec 2014" 
        android:id="@+id/etaValue" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_marginLeft="20dp" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="8dp"> 

       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/imageView4" 
        android:src="@drawable/ic_launcher" 
        android:layout_marginRight="10dp" 
        android:layout_weight="1"/> 

       <LinearLayout 
        android:orientation="vertical" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="BioMass Pellets" 
         android:id="@+id/productName" /> 

        <LinearLayout 
         android:orientation="horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="Quantity: " 
          android:id="@+id/quantity_label" /> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="40mts" 
          android:id="@+id/quantity_value" /> 
        </LinearLayout> 

        <LinearLayout 
         android:orientation="horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="Amount: " 
          android:id="@+id/amount_label" /> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="200 USD" 
          android:id="@+id/amount_value" /> 
        </LinearLayout> 

        <LinearLayout 
         android:orientation="horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="Quantity: " 
          android:id="@+id/rate_label" /> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="40 USD" 
          android:id="@+id/rate_value" /> 


        </LinearLayout> 

       </LinearLayout> 

      </LinearLayout> 

     </LinearLayout> 
</LinearLayout> 
    </ScrollView> 
</LinearLayout> 
+0

imageview尚不可見 –

1

錯誤解釋本身,你不能把多個視圖直接孩子滾動視圖。您正在scrollview中直接放置線性佈局和視圖。它只能有一個單一的視圖作爲直接的孩子。因此與垂直方向附上最外面的LinearLayout和另外一個的LinearLayout內

1

您可以添加背景(#000000)屬性和paddingButtom以滾動型落實這項工作,所以最後的觀點是不需要了。

0

您無法在滾動視圖中添加兩個單獨的子項。這就是爲什麼它會給予例外。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/scrollView" > 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:text="PI 12343" 
       android:id="@+id/proformo" 
       android:layout_marginTop="20dp" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"/> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="Cargo Shipped" 
        android:layout_marginLeft="20dp" 
        android:id="@+id/shippingStatus" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="on07 oct 2015" 
        android:id="@+id/shippingDate" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="PI 12345" 
        android:id="@+id/invoiceNumber" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="on Dec 2016" 
        android:id="@+id/invoiceDate" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="Shipment Reference No :" 

        android:id="@+id/shipment_ref_no_label" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="4312412412" 
        android:id="@+id/shipment_ref_no_value" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="20dp" 
       android:layout_marginBottom="8dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="ETD:" 
        android:id="@+id/etdLabel" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="24 oct 2015" 
        android:id="@+id/etdValue" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="ETA:" 
        android:id="@+id/etaLabel" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:text="09 dec 2014" 
        android:id="@+id/etaValue" /> 
      </LinearLayout> 

      <LinearLayout 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_marginLeft="20dp" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="8dp"> 

       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/imageView4" 
        android:src="@drawable/ic_launcher" 
        android:layout_marginRight="10dp" 
        android:layout_weight="1"/> 

       <LinearLayout 
        android:orientation="vertical" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceMedium" 
         android:text="BioMass Pellets" 
         android:id="@+id/productName" /> 

        <LinearLayout 
         android:orientation="horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="Quantity: " 
          android:id="@+id/quantity_label" /> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="40mts" 
          android:id="@+id/quantity_value" /> 
        </LinearLayout> 

        <LinearLayout 
         android:orientation="horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="Amount: " 
          android:id="@+id/amount_label" /> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="200 USD" 
          android:id="@+id/amount_value" /> 
        </LinearLayout> 

        <LinearLayout 
         android:orientation="horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="Quantity: " 
          android:id="@+id/rate_label" /> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textAppearance="?android:attr/textAppearanceMedium" 
          android:text="40 USD" 
          android:id="@+id/rate_value" /> 


        </LinearLayout> 

       </LinearLayout> 

      </LinearLayout> 

      <View 
      android:layout_width="match_parent" 
      android:layout_height="0.5dp" 
      android:background="#000000" /> 

     </LinearLayout> 



    </ScrollView> 
</LinearLayout> 
0

刪除的ImageView的layout_weight屬性,像這樣:

<ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/imageView4" 
       android:src="@drawable/ic" 
       android:layout_marginRight="10dp"/>