Android的:如何获得的ImageView,以填补屏幕 [英] Android: how to get ImageView to fill screen
问题描述
我不知道如何获得的图像来填充屏幕,已经尝试了一切,也许有,我应该使用一些特定布局..?
我使用的是ImageView的,然而,这只是填补了约70%的画面,留下空白底部...
目前,我只是使用的LinearLayout和它的背景设置为我的形象。虽然这个充满屏幕,图像略微streched,我不想要的。
任何帮助将是很大的AP preciated! :)
我的布局文件的ImageView的标签内的code是:
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:scaleType =centerCrop
机器人:adjustViewBounds =真
机器人:SRC =@可绘制/图像
//你的XML图像属性为
安卓scaleType =fitXY
或 //使用直通编程
imgview.setScaleType(ScaleType.FIT_XY);
注意:这也适用于在图像设置与Android:SRC =...,而不是机器人:背景=...为背景的默认设置为伸展和适合查看。
I don't know how to get an image to fill the screen, have tried everything, maybe there is some particular layout I should be using..?
I'm using an ImageView, however this just fills about 70% of the screen, leaving blank space at the bottom...
At the moment i'm just using a LinearLayout and setting its background to my image. While this fills the screen, the image is slightly streched, which I don't want.
Any help would be greatly appreciated! :)
The code inside the ImageView tags of my layout file are:
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:src="@drawable/image"
//in your xml Image attribute as
android:scaleType="fitXY"
or //using thru programatically
imgview.setScaleType(ScaleType.FIT_XY);
Note: this applies to when the image is set with android:src="..." rather than android:background="..." as backgrounds are set by default to stretch and fit to the View.
这篇关于Android的:如何获得的ImageView,以填补屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!