根据调整屏幕分辨率的Andr​​oid图像 [英] Resize the images according screen resolution Android

查看:133
本文介绍了根据调整屏幕分辨率的Andr​​oid图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

予有在主体上的背景图像。 我想实现的是:

I have a background image in body. What I want to achieve is that:

1) - 计算访问者的屏幕分辨率
。 2) - 根据该决议我要调整我的背景图片

1) - Calculate the visitor screen resolution.
2) - based on that resolution I want to resize my background image.

我知道拿到的屏幕分辨率为

I know get the screen resolution as a

Display display = getWindowManager().getDefaultDisplay();
width_screen = display.getWidth();
height_screen = display.getHeight();

但我不知道该如何调整,根据用户的屏幕分辨率的图片。

But I don't know how to resize the images according screen resolution of user.

谁能帮助? 谢谢..

Can anyone help? Thanks..

推荐答案

将一个ImageView的布局中的文件,并设置

Put a ImageView in your layout file and set

    android:layout_width="match_parent"
    android:layout_height="match_parent"

如果你想保持方面使用:

If you want to keep the aspect use:

    android:scaleType="centerInside"

如果你不关心的宽高比使用:

If you dont care about the aspect ratio use:

    android:scaleType="fitXY"

这篇关于根据调整屏幕分辨率的Andr​​oid图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆