如何让ImageView占据整个屏幕?

时间:2014-07-22 08:26:10

标签: android imageview

我正在构建一个Android应用程序。在我的活动中,我已经放入了ImageView。图像居中于中间,四面都有白色背景条。我使用了Toggle HeightToggle Width,但没有用。我需要图像覆盖整个屏幕,没有背景可见。请参考下面的截图。

Screenshot

2 个答案:

答案 0 :(得分:5)

更改为:

 <ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="fitXY"
    android:src="@drawable/icon" />

如果您已经给出了边距或填充,则将其从布局中删除。

答案 1 :(得分:0)

这就是我使用background.png在我的应用中实现整页图像背景的方式:

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

   ---- Other widgets here on top of the image ------
</LinearLayout>
相关问题