简体   繁体   English

多种屏幕尺寸的UI设计

[英]UI design for Multiple Screen sizes

I had developed an android app with RealtiveLayout but when I run on small screen devices the fields are overlapping. 我用RealtiveLayout开发了一个android应用,但是当我在小屏幕设备上运行时,这些字段是重叠的。

How can I get the width and height of the device programatically so that it is easier for to adjust the screen size 如何以编程方式获取设备的宽度和高度,以便更轻松地调整屏幕尺寸

为此,请使用Horizo​​ntall ScrollView,它在小型设备上也看起来很完美。

  <compatible-screens>
    <!-- all small size screens -->
    <screen android:screenSize="small" android:screenDensity="ldpi" />
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />


    <!-- support for Xperia Z, Galaxy S4 and HTC One -->
    <screen android:screenDensity="480" android:screenSize="normal" /> 
    <screen android:screenDensity="480" android:screenSize="large" /> 
    </compatible-screens> 

Try this code in the manifest I think this will work.. Other wise Create separate folders in res folder like layout-small, layout-large, layout-normal, and use appropriate images in the drawable folder drawable-hdpi, drawable-ldpi, drawable-mdpi... I am sure this will help you for various screen orientation.. 尝试在清单文件中使用此代码,我认为这可以。.否则,请在res文件夹中创建单独的文件夹,例如layout-small,layout-large,layout-normal,并在drawable文件夹drawable-hdpi,drawable-ldpi, drawable-mdpi ...我相信这会帮助您进行多种屏幕定向。

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

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