2015-01-08 20 views
0

有關的文件(http://developer.android.com/guide/practices/screens-distribution.html#FilteringHandsetApps)所有藥片,你應該做的:濾除谷歌播放(無屏幕兼容模式)

<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" /> 
    <!-- 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" /> 
</compatible-screens> 

但這也過濾掉手機與例如xxhdpi - 不幸的是,你不能添加xxhdpi,因爲它不能作爲一個值:http://developer.android.com/guide/topics/manifest/compatible-screens-element.html 支持屏也沒辦法爲:

注意:如果你使用的元素反向 方案(當你的應用程序不兼容較大的屏幕) 並將較大的屏幕尺寸屬性設置爲「false」,則外部 服務(如Google Play)不會應用過濾。您的應用程序 仍可用於較大的屏幕,但運行時,它將不會調整大小以適應屏幕。相反,系統將模擬 手機屏幕尺寸(約320dp x 480dp;有關更多信息,請參閱屏幕兼容性 模式)。如果您想阻止您的應用程序 在較大屏幕上下載,請使用上一節中討論的 關於聲明應用程序僅適用於 手機。

另一種選擇是過濾電話功能 - 但有些平板電腦具有電話功能。有沒有辦法做到這一點?

+0

具有電話功能的平板電腦和具有大屏幕平板電腦的手機之間的區別是什麼? – Murat

+0

界限是流動的 - 但我知道應用程序atm在7''上看起來很糟糕 - 理想情況下我想過濾掉所有內容> 7'直到這個 – ligi

回答

3

這應該工作:

<compatible-screens> 
    <!-- all small size screens --> 
    ... 
    <!-- support for xxhdpi densities --> 
    <screen android:screenSize="small" android:screenDensity="480" /> 
    <!-- all normal size screens --> 
    ... 
    <!-- support for xxhdpi densities --> 
    <screen android:screenSize="normal" android:screenDensity="480" /> 
</compatible-screens> 

按照the documentation itself,你只需將xxhdpi屏幕的原始int值:

注意:此屬性當前不接受xxhdpi作爲有效的 值,但您可以改爲指定480作爲值,即xhdpi屏幕的近似閾值 。

0

你試過了嗎?

<supports-screens android:largestWidthLimitDp="500"/> 
+0

的佈局優化否 - 如文檔所述:android:largestWidthLimitDp 該屬性允許您通過指定應用程序所設計的最大「最小屏幕寬度」來強制啓用屏幕兼容模式。如果設備可用屏幕的最小邊大於此值,則應用程序將以屏幕兼容模式運行,用戶無法禁用它。 而且我不想兼容模式 – ligi

-1
<supports-screens 
    android:largeScreens="true" 
    android:normalScreens="false" 
    android:requiresSmallestWidthDp="600" 
    android:smallScreens="false" 
    android:xlargeScreens="true" /> 

及其you.its過濾片只有像7幫助和10 inches.try與這個曾經

+0

我知道這是有效的 - 但我想要相反 – ligi

0

我反而利用這個配置,以便可以包括更多的手機:

<compatible-screens> 
    <!-- 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="280" /> 
    <screen android:screenSize="small" android:screenDensity="360" /> 
    <screen android:screenSize="small" android:screenDensity="420" /> 
    <screen android:screenSize="small" android:screenDensity="480" /> 
    <screen android:screenSize="small" android:screenDensity="560" /> 
    <screen android:screenSize="small" android:screenDensity="640" /> 
    <!-- 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="280" /> 
    <screen android:screenSize="normal" android:screenDensity="360" /> 
    <screen android:screenSize="normal" android:screenDensity="420" /> 
    <screen android:screenSize="normal" android:screenDensity="560" /> 
    <screen android:screenSize="normal" android:screenDensity="640" /> 
</compatible-screens> 

這樣你支持http://developer.android.com/guide/topics/manifest/compatible-screens-element.html提到的所有可能的密度也可以增加640,如果你想支持一些最新的手機(例如三星Galaxy S6)