Android的支持多屏幕 [英] Android support multiple screens

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

问题描述

我只是做了我的申请,但是我发现它从一个屏幕的不同而异。结果
我搜索的方式,使其在模拟器中的所有屏幕,但我找不到\\了解。

I just made my application, however I found that its different from one screen to another.
I searched for a way to make it as in the emulator for all screens, but I couldn't find\understand how.

我可以知道应用程序的开发人员的受欢迎程度如何使其成为所有屏幕?

Can I know how popular apps developers make it for all screens?

推荐答案

如果你想使你的布局对每一个你必须做出不同的手机屏幕和分辨率的不同布局的设备正常工作

if you want to make your layout to work on each and every device you have to make different layout for different mobile screens and resolutions

看看这个链接 http://developer.android.com/guide/做法/ screens_support.html

例如

如果你想按照屏幕resloution创建您的布局

if you want to create your layouts according to screen resloution

layout-ldpi (low) ~120dpi
layout-mdpi (medium) ~160dpi
layout-hdpi (high) ~240dpi
layout-xhdpi (extra-high) ~320dpi
layout-xxhdpi (extra-extra-high) ~480dpi
layout-xxxhdpi (extra-extra-extra-high) ~640dpi

如果您想根据屏幕尺寸来创建布局

if you want to create your layout according to screen size

layout-small = ldpi
layout = mdpi
layout-large = hdpi
layout-xlarge = xhdpi

和检查你的设备的分辨率

and to check your device resolution

    int density = getResources().getDisplayMetrics().densityDpi;

     switch (density) {
     case DisplayMetrics.DENSITY_LOW:
     Toast.makeText(this, "LDPI", Toast.LENGTH_SHORT).show();
     break;
     case DisplayMetrics.DENSITY_MEDIUM:
     Toast.makeText(this, "MDPI", Toast.LENGTH_SHORT).show();
     break;
     case DisplayMetrics.DENSITY_HIGH:
     Toast.makeText(this, "HDPI", Toast.LENGTH_SHORT).show();
     break;
     case DisplayMetrics.DENSITY_XHIGH:
     Toast.makeText(this, "XHDPI", Toast.LENGTH_SHORT).show();
     break;
    } 

检查设备的分辨率,然后进行布局accordingle

check your device resolution and then make your layout accordingle

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

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