适用于HTC Desire和HTC感觉多屏 [英] Multiple screens for HTC Desire and HTC Sensation

查看:259
本文介绍了适用于HTC Desire和HTC感觉多屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到编程多个屏幕和不同屏幕大小和密度provideing资源的事情......但这种感觉决议案我发疯:S,我有布局工作perfectlly上的HTC Desire它们被放置在布局和图纸被放置在华电国际,一切都可以正常使用!问题是当我尝试运行轰动:(应用程序,一切都missplaced,看起来非常难看。

I read things about programming for multiple screens and provideing resources for different screen size and density... But this sensation resolutions drive me crazy :S, I have layout that works perfectlly on HTC Desire they are placed in layout and the drawings are placed in hdpi, everything is working perfectly! the problem comes when I try to run the app on sensation :(, everything is missplaced and looks very ugly.

我想要做的事情是对的感觉和欲望不同的布局。

The thing I want to do is to have different layout for sensation and desire.

我的问题是放在哪里的感觉布局?
我应该使用什么预选赛名轰动>?

My question is where to put the sensation layouts ? What qualifier name should I use for sensation >?

感谢

推荐答案

试着找到分辨率和使用以下code中的设备(感觉)的密度。

Try finding the resolution and the density of the device (Sensation) using the following code.

    Display display = getWindowManager().getDefaultDisplay();
    DisplayMetrics dm = new DisplayMetrics();
    display.getMetrics(dm);

    int width = display.getWidth();
    int height = display.getHeight();
    int density = dm.densityDpi;
    String densityString = null;

    if(density == DisplayMetrics.DENSITY_HIGH) {
        densityString = "HDPI";
    } else if(density == DisplayMetrics.DENSITY_MEDIUM) {
        densityString = "MDPI";
    } else if(density == DisplayMetrics.DENSITY_LOW) {
        densityString = "LDPI";
    }

然后使用你适当的资源名称预选赛的绘制和布局文件夹,如多屏支持。 (例如)的绘制-大华电国际布局大华电国际

这是不可行的所有时间,因为你将无法访问所有设备在那里。因此,它是更好地创建基于中描述的表不同的显示配置,自动真空淀积系统的如何测试在多个屏幕从上面给出的链接的应用。

This is not feasible all the times, since you won't have access to all the devices out there. So it's better to create AVDs with different display configurations based on the table depicted in How to Test Your Application on Multiple Screens from the above given link.

这篇关于适用于HTC Desire和HTC感觉多屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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