Android 2.0中的分辨率支持 [英] Resolution support in Android 2.0

查看:159
本文介绍了Android 2.0中的分辨率支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

收到了我的第一个Motorola Droid用户的电子邮件. Android 2.0中引入的新480x854分辨率(而不是320x480)对我的用户界面造成了严重破坏.一切都变小了,位置不好.

Received an email from my first Motorola Droid user. The new 480x854 resolution introduced in Android 2.0 (as opposed to 320x480) is wreaking havoc with my user interfaces. Everything is smaller and ill-positioned.

给我的印象是,如果我们遵循XML布局指南,那么我们就可以解决问题,因为没有使用绝对坐标.有没有人有使UI解析安全的经验?对于每个分辨率乘每个方向,我们都需要main.xml吗?

I was under the impression that if we follow the XML layout guides we were resolution-safe, as no absolute coordinates are used. Does anyone have experience in making the UI resolution-safe? Will we need a main.xml for each resolution times each orientation?

推荐答案

您使用了哪个尺寸单位?

Which dimension units did you use?

使用dpsp的AFAIK应该可以确保您的安全.

AFAIK using dp and sp should keep you safe.

摘自文档:

dp 与密度无关的像素-基于像素的抽象单位 屏幕的物理密度.这些 单位相对于160 dpi 屏幕,所以一个dp是一个 160 dpi屏幕.比例 像素对像素的变化会随着 屏幕密度,但不一定 直接比例.注意:编译器 接受两个浸入"和"dp" "dp"与"sp"更一致.

dp Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".

sp 与比例无关的像素-就像dp单位一样,但它也是 由用户的字体大小缩放 偏爱.建议您使用 指定字体大小时使用此单位, 因此它们将针对 屏幕密度和用户偏好.

sp Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.

这篇关于Android 2.0中的分辨率支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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