Why "xxhdpi" is not allowed the value of the screenDensity parameter in the manifest [Table restriction]

Why xxhdpi and xxxhdpi invalid values ​​for the screenDensity parameter <screen> in the manifest?

I am trying to limit the use of my application on tablets using the recommended solution from the official website of Android developers. Application announcement is available only for phones . I want to mark only small and regular screen sizes (with any density) as compatible:

 <compatible-screens> <!-- all small size screens --> <screen android:screenDensity="ldpi" android:screenSize="small" /> <screen android:screenDensity="mdpi" android:screenSize="small" /> <screen android:screenDensity="hdpi" android:screenSize="small" /> <screen android:screenDensity="xhdpi" android:screenSize="small" /> <!-- 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" /> </compatible-screens> 

However adding

  <screen android:screenDensity="xxhdpi" android:screenSize="normal" /> 

is not allowed. Cannot compile with Error: String types not allowed (at 'screenDensity' with value 'xxhdpi'). The same thing happens for "xxxhdpi".

I found that inserting an integer for the appropriate density (for example, screenDensity="480" ) works, but I wonder why it doesn't allow string expressions to be used for all existing density codes?

+5
source share
1 answer

The Android Developer's Guide for Screen Density seems to be consistent with what you experienced. He also mentions that for xxhdpi and above you will have to manually enter dpi values. As for why, it doesn't really say ...

http://developer.android.com/guide/topics/manifest/compatible-screens-element.html

Note. This attribute does not currently accept xxhdpi as a valid value, but instead you can specify 480 as a value, which is an approximate threshold for xhdpi screens.

+4
source

Source: https://habr.com/ru/post/1205720/


All Articles