2012-05-18 41 views
0
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/LinearLayout1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_vertical" 
    android:scaleType="fitXY" 
    android:adjustViewBounds="true" 
    android:layout_x="0dip" 
    android:layout_y="0dip" 
    android:background="@drawable/mlview1" /> 

如何显示图像以适合整个屏幕?

我使用的是Android模拟器2.2。我的图像水平占用屏幕,但垂直显示与底部有较大差距。图像大小是800X600。是否应该重新调整大小然后再使用?

+0

请注明斯尔詹,如果你ACC epted他的回答 –

回答

1

确保:
1.高度和宽度上都父母和孩子是FILL_PARENT
2.您设置SRC财产,而不是背景一个图像上

注意:您也不需要layout_x也不layout_y

+0

非常感谢!有效! :) – Shiven