繁体   English   中英

如何使ImageView占据整个屏幕?

[英]How to make an ImageView take up the entire screen?

我正在构建一个android应用程序。 我在活动中加入了ImageView 图像居中位于中间,在所有四个侧面上都留有白色背景。 我已经使用了Toggle HeightToggle Width但没有帮助。 我需要图像覆盖整个屏幕,并且看不到背景。 请参考下面的截图。

截图

更改为此:

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

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

这就是我使用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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM