简体   繁体   English

Android多萤幕解析度

[英]Android Multiple Screen Resolutions

I've created a android layout that looks fine on my Galaxy s2 (480×800) device. 我创建了一个Android布局,在我的Galaxy s2(480×800)设备上看起来不错。 I want to support a layout for and Galaxy s3 (720x1280) so i created a AVD with those specs, then copied the res/layout directory and contents to two other directories: res/layout, res/layout-large and res/layout-xlarge. 我想支持Galaxy S3(720x1280)的布局,所以我用这些规格创建了一个AVD,然后将res / layout目录和内容复制到其他两个目录:res / layout,res / layout-large和res / layout- XLARGE。 To test that the layouts were working positioned a test button at parent-center in res/layout, parent-left in res/layout-large and parent-right in res/layout-xlarge. 要测试布局是否正常工作,请在res / layout中将测试按钮放在父中心,在res / layout-large中将parent-left放置在res / layout-xlarge中,将parent-right放置在res / layout-xlarge中。 If i run the application on my device (480×800) or in the AVD (720x1280) the test button is always at parent-center. 如果我在设备(480×800)或AVD(720x1280)上运行应用程序,则测试按钮始终位于父中心。 Why isn't the test button positioned by the values specified in res/layout-large or res/layout-xlarge. 为什么测试按钮没有按res / layout-large或res / layout-xlarge中指定的值定位。

My manifest is as follows: 我的清单如下:

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" />

<supports-screens 
        android:normalScreens="true" 
        android:largeScreens="true" 
        android:xlargeScreens="true"
        android:anyDensity="true" /> 

I am targeting 2.3.3 and have also cleaned my build before testing 我的目标是2.3.3,并且在测试之前也清理了我的构建

Im seriously going mad so any help would be appreciated. 我很生气,所以不胜感激。

I don't believe the Galaxy S3 is a "large" screen. 我不认为Galaxy S3是“大”屏幕。 Small/normal/large/xlarge refer to physical size, not pixels. 小/正常/大/超大是指物理尺寸,而不是像素。 You need a combination of screen density and screen size to target different devices. 您需要将屏幕密度和屏幕尺寸组合在一起才能定位不同的设备。 Read the Android guides and training for more details on this. 阅读Android 指南培训以获取更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM