的Andr​​oid / Eclipse中:用图片“大小处理 [英] Android/Eclipse : Dealing with images' size

查看:127
本文介绍了的Andr​​oid / Eclipse中:用图片“大小处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse的Andr​​oid应用程序,我努力掌握屏幕上的图像定位。我已经把图像中的相对布局,我想图像的边界匹配屏幕的完美边界,但是当我手动扩展图像它永远不会适合,即使我把填充:/
(见右边是好的,但不是左,问题甚至不是一个关于屏幕尺寸的问题)

I am building an android application with eclipse and I'm struggling to master the image positioning in the screen. I have put an image in a relative layout, and I want the borders of the image to match perfectly the borders of the screen, but when I extend the image manually it never fits and even if I put padding :/ (see the right side is ok, but not the left, the problem is not even a problem about the dimensions of the screen)

感谢您的帮助。

推荐答案

如果你想做到这一点,你需要使用这个code把屏幕的尺寸:

If you want to do that, you need to take the dimensions of the screen using this code :

// pixels
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;

然后,你需要使用的宽度和高度属性来设置编程画面的尺寸。

Then you need to set programmatically the dimensions of the picture using the width and height properties.

这篇关于的Andr​​oid / Eclipse中:用图片“大小处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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