ANDROID Studio:选择看似错误的布局 [英] ANDROID Studio: Picking up seemingly wrong layout

查看:85
本文介绍了ANDROID Studio:选择看似错误的布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

致歉的人们,我早些时候把这个贴错了头.所以忽略重复

APOLOGIES folks, I posted this earlier in a wrong head; so ignore duplication

我是android studio的新手.因此,如果查询比较琐碎,请原谅.我的问题是了解布局.

I am new to android studio. so please excuse if the query is trivial. My problem is with understanding the layouts.

我的布局和相应的values文件夹如下所示.我的问题是没有选择正确的布局.例如,对于Nexus 4(4.7英寸,768x1280,xhdpi),在横向模式下,布局是从布局"文件夹中提取的.根据我的理解(可能是完全错误的),它应该是从layout-sw720dp-xhdpi中选择的.有什么建议吗?

My layout and the corresponding values folder is as shown below. My problem is that a correct layout is not being picked up. For example, for Nexus 4 (4.7inch, 768x1280, xhdpi), in the landscape mode, the layout is being picked up from the 'layout' folder. As per my understanding (which might be totally wrong ) it should have been picked from layout-sw720dp-xhdpi. Any suggestions please?

推荐答案

sw 表示最小宽度.因此,如果该设备在纵向模式下的宽度为320dp,在横向模式下的宽度为720dp,那么您结束该设备的最小宽度为320dp.

sw stands for smallest width. So if the a device has a width of 320dp in portrait mode and 720dp in landscape mode then you end the device's smallest width is 320dp.

尝试使用layout-w720dp-xhdpi而不是layout-sw720dp-xhdpi,看看它是否有效.

Try use layout-w720dp-xhdpi instead of layout-sw720dp-xhdpi and see if it works.

根据维基百科"Nexus 7屏幕现在具有1920×1200像素分辨率(960dp×600dp)".所以它的最小宽度是600dp,这就是为什么不使用您的布局的原因.

According to Wikipedia "The Nexus 7 screen now has a 1920×1200 pixel resolution (960dp × 600dp)". So its smallest width is 600dp which is why your layout isn't being used.

这篇关于ANDROID Studio:选择看似错误的布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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