简体   繁体   English

在定义 Android Manifest 中的兼容性时,哪种方式是正确的?

[英]In defining the compatibilities in Android Manifest, which way is correct?

While adding the compatibility versions of screens in manifest, I have this doubt, which way is the correct way as per Android developing.在清单中添加屏幕的兼容性版本时,我有这个疑问,根据 Android 开发,哪种方式是正确的方式。

Is this correct?这个对吗?

<screen android:screenSize="small" android:screenDensity="ldpi | mdpi | hdpi | xhdpi | xxhdpi | 280 | 360 | 420 | 480 | 560" /> 

or below is correct?或以下是正确的?

    <screen android:screenSize="normal" android:screenDensity="ldpi" /> 
    <screen android:screenSize="normal" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="normal" android:screenDensity="280" /> 
    <screen android:screenSize="normal" android:screenDensity="xhdpi" /> 
    <screen android:screenSize="normal" android:screenDensity="360" /> 
    <screen android:screenSize="normal" android:screenDensity="420" /> 
    <screen android:screenSize="normal" android:screenDensity="xxhdpi" /> 
    <screen android:screenSize="normal" android:screenDensity="560" /> 
    <screen android:screenSize="normal" android:screenDensity="xxxhdpi" /> 

In my case the below solution worked.就我而言,以下解决方案有效。 Please try with this solution请尝试使用此解决方案

 <compatible-screens>

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

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

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

        <!-- Special case for Nexus 7 -->
        <screen
            android:screenDensity="213"
            android:screenSize="large" />

    </compatible-screens>

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

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