How to make app work on all screens “greater” than

2019-08-27 11:05发布

问题:

I am beginner Android developer and I am in a struggle making my app look good on all screens, i made different layouts for hdpi,xhdpi,xxhdpi to solve that, since some seekbars and textviews were disappearing on smaller screens..

Is there a way to specify in android manifest that only people with hdpi screens and above can download my app from playstore?

I looked on below stackoverflow, and have read android developer guides, but I can't find solution to make it work on hdpi and above.

https://developer.android.com/guide/topics/manifest/compatible-screens-element.html https://developer.android.com/guide/practices/screens_support.html

回答1:

You just need to add something like this in your Manifest depending on what you want:

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

Please read this for more info: https://developer.android.com/guide/topics/manifest/compatible-screens-element.html