2011-08-11 45 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