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

我是研究僧i 提交于 2019-12-24 18:31:18

问题


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



来源:https://stackoverflow.com/questions/46608434/how-to-make-app-work-on-all-screens-greater-than-hdpi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!