2012-12-11 29 views
0

我在我的一個應用程序中使用了此佈局。我不知道它爲什麼會變形。主要問題是,在所有三個LinearLayout塊中,只有第一個TextView顯示在屏幕上,代替TextViews之後顯示一個大的空白區域。從Android中的XML生成的扭曲佈局

圖像所顯示的快照是Snapshot ...

Layout.xml

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="5sp" > 

    <LinearLayout 
     android:id="@+id/ll_images" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:orientation="vertical" 
     android:padding="10sp" > 

     <ImageView 
      android:id="@+id/certification_image" 
      android:layout_width="100sp" 
      android:layout_height="wrap_content" 
      android:contentDescription="@string/details_image" 
      android:visibility="gone" /> 

     <ImageView 
      android:id="@+id/image_details_page" 
      android:layout_width="100sp" 
      android:layout_height="100sp" 
      android:contentDescription="@string/details_image" /> 
    </LinearLayout> 

    <TextView 
     android:id="@+id/details_name" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_toLeftOf="@id/ll_images" 
     android:padding="10sp" 
     android:textColor="#040404" 
     android:textSize="25sp" 
     android:textStyle="bold" 
     android:typeface="sans" /> 

    <TextView 
     android:id="@+id/details_tv1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@id/details_name" 
     android:layout_toLeftOf="@id/ll_images" 
     android:paddingLeft="5sp" 
     android:textColor="#343434" 
     android:textSize="15sp" 
     android:typeface="sans" /> 

    <LinearLayout 
     android:id="@+id/ll_facts" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ll_images"> 

     <TextView 
      android:id="@+id/tv_facts" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/gradient_bg" 
      android:padding="10sp" 
      android:text="Facts" 
      android:textColor="@android:color/darker_gray" 
      android:textSize="18sp" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/details_tv2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:paddingLeft="5sp" 
      android:textSize="15sp" 
      android:text="@string/test" /> 

     <TextView 
      android:id="@+id/details_tv3" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:paddingLeft="5sp" 
      android:text="@string/test" 
      android:textSize="15sp" /> 

     <TextView 
      android:id="@+id/details_tv4" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:paddingLeft="5sp" 
      android:text="@string/test" 
      android:textSize="15sp" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/ll_foundation" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ll_facts"> 

     <TextView 
      android:id="@+id/tv_foundation" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/gradient_bg" 
      android:padding="10sp" 
      android:text="Foundation Statement" 
      android:textColor="@android:color/darker_gray" 
      android:textSize="18sp" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/details_tv5" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:paddingLeft="5sp" 
      android:textColor="#343434" 
      android:text="@string/test" 
      android:textSize="15sp" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/ll_overview" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ll_foundation"> 

     <TextView 
      android:id="@+id/tv_overview" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/gradient_bg" 
      android:padding="10sp" 
      android:text="Overview" 
      android:textColor="@android:color/darker_gray" 
      android:textSize="18sp" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/details_tv6" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/test" 
      android:paddingLeft="5sp" 
      android:textColor="#343434" 
      android:textSize="15sp" /> 
    </LinearLayout> 

    <Button 
     android:id="@+id/btnViewScorecard" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/ll_overview" 
     android:layout_margin="5sp" 
     android:background="@drawable/search_button" 
     android:paddingLeft="10sp" 
     android:text="@string/ViewScorecard" 
     android:textColor="#FFFFFF" 
     android:typeface="sans" 
     android:visibility="gone"/> 
</RelativeLayout> 

任何幫助將非常感激。提前致謝!!!

+0

你是什麼意思失真? –

+0

有沒有截圖? – Renjith

+0

@AndroSelva當我通過在所有textView中輸入臨時字符串來檢查佈局時,它會顯示一個太長的頁面(如20頁長),並且它不會在任何textView中顯示任何文本。 –

回答

0

最後我已經想通了......我所要做的就是,我不得不添加以下行我的LinearLayout

android:orientation="vertical" 

感謝所有幫助...

0

您忘記 xmlns:android="http://schemas.android.com/apk/res/android"

只要改變
<RelativeLayout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

+0

試過這個...對不起...不工作... –