不同分辨率/密度的Andr​​oid对齐ImageViews [英] Android align ImageViews in different resolutions/densities

查看:116
本文介绍了不同分辨率/密度的Andr​​oid对齐ImageViews的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我的客户收到了PSD布局,我把它包含了一些固定的背景图像,这些图像下面应该有一些按钮,TextViews等。

I have received a PSD layout from my client, and I it contains some fixed background images, and below those images there should be some Buttons, TextViews, etc.

问题是,例如游戏结束屏幕上有一个背景,那么就应该是你赢了或你输了,从左上角抵消特定以上的背景图像。
如果我设计的界面480x800的手机,并指定以像素为单位的偏移量,一切都OK。但是,如果我将它部署到小320x480手机,它当然不适合,因为像素偏移现在不同和背景进行缩放。

The problem is, that for example the Game Over screen has a background, then there should be image with "You win" or "You lose", above the background in specific offset from top left corner. If I design the interface for 480x800 phones, and specify the offset in pixels, everything's OK. But if I deploy it into 320x480 phone, it of course doesn't fit, because pixel offsets are different now and the background is scaled.

使用DIP单位没有帮助,因为较小的手机有物理上较小的屏幕了。

Using dip units doesn't help, because the smaller phones have physically smaller screens too.

在这里是想我做了一个草图。所有的,它应该类似于手机上的240×320做540x960。是否有可能以某种方式做到这一点单XML布局文件或做我必须手工code偏移量为每一个在我脑海分辨率?

here is a sketch of what I'd like to do. All and it should look similar on phones from 240x320 do 540x960. Is it possible to somehow do this in single XML layout file or do I have to hand-code offsets for every resolution that comes to my mind?

主要的问题是,在图片上,围绕你赢了的红框是它融入了橙色背景的地方,因为这是显卡的设计方式。而当应用程序是在手机与较小的分辨率运行,我不知道究竟如何使橙​​色其中的你赢了的景象。

The main problem is that on the picture, the red frame around "you win" is a place where it fits into the orange background, because that's the way the graphics is designed. And when the app is run on phone with smaller resolution, I don't exactly know how to align the "you win" picture on the orange one. .

推荐答案

从提供PSD针对不同屏幕尺寸的布局创造出不同大小的图像,并为不同的屏幕大小不同的布局xml文件,在不同的布局文件,您可以提供参考它适合布局图像。

create different size images from provided PSD for different screen size layout, and create different layout xml file for different screen size, in different layout file you can provide reference of images which fit for layout.

为了更好aprroach你应该去这里,也是<一个href=\"http://stackoverflow.com/questions/8255985/how-to-support-different-screen-size-in-android\">this

For better aprroach you should go here and also this

这篇关于不同分辨率/密度的Andr​​oid对齐ImageViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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