2011-08-11 85 views
2


我有以下代碼:機器人XML滾動視圖和線性佈局問題

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <LinearLayout android:orientation="vertical" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"> 

     <ImageView android:src="@drawable/ducks_r2_c1" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" /> 
     <ImageView android:src="@drawable/ducks_r3_c1" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" android:clickable="true"/> 
     <ImageView android:src="@drawable/ducks_r4_c1" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" android:clickable="true"/> 
     <ImageView android:src="@drawable/ducks_r5_c1" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" android:clickable="true"/> 
     <ImageView android:src="@drawable/ducks_r6_c1" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" android:clickable="true"/> 

    </LinearLayout> 

</ScrollView> 

我已經使用layout_width = 「FILL_PARENT」 無處不在。但這是它在仿真器上顯示的截圖。
enter image description here
我不想在圖像兩邊的空間。
爲什麼它會出現這樣的情況?我該如何糾正它?
謝謝

回答

0

ScrollView只會膨脹到其中有多少物品。

您應該能夠使用的LinearLayout(或其它更可預測的佈局)作爲母體與android:layout_height="match_parent"您的滾動型和了滾動設置爲android:layout_height="wrap_content"與同爲兩個layout_width來解決這個問題。

+0

讓我試試這個,讓你知道 – Brahadeesh

+0

謝謝。這沒有用。 android:scaleType =「fitXY」雖然工作。無論如何,感謝您的幫助。 – Brahadeesh