机器人:在ImageView的,以适合屏幕拉伸图像 [英] android: stretch image in imageview to fit screen
本文介绍了机器人:在ImageView的,以适合屏幕拉伸图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有有它的高度和宽度设置为FILL_PARENT与LinearLayout中具有同一值的ImageView的。所以,我想这应该设置我的图片以适应屏幕。但它只适合像80%(保证金顶部和底部在横向模式下)。
I have an imageview that has its height and width set to "fill_parent" with a linearlayout that has the same values set. So i suppose this should set my images to fit the screen. But it only fits like 80% (margin top and bottom in landscape mode).
所以,香港专业教育学院尝试了以下code,但没有成功:
So ive tried the following code, without success:
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
imgView.setMinimumWidth(width);
imgView.setMinimumHeight(height);
imgView.setMaxWidth(width);
imgView.setMaxHeight(height);
任何其他的想法?
Any other ideas?
推荐答案
使用 imgview.setScaleType(ScaleType.FIT_XY);
这篇关于机器人:在ImageView的,以适合屏幕拉伸图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文