我正在为手机制作一个安卓应用程序。我的 UI 没有针对平板电脑进行优化,所以我不希望平板电脑用户使用它。如何限制我的应用在平板电脑上运行?
问问题
187 次
1 回答
3
您必须使用<compatible-screens>
清单中的元素来明确声明您希望支持的屏幕尺寸和密度。
以下示例来自有关此主题的文档:
<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
设备上(例如,SONY Xperia Z、Droid DNA)。您还需要添加另一对<screen>
元素xxhdpi
来涵盖该场景:
<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" />
<!-- 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" />
</compatible-screens>
于 2013-05-01T20:05:10.220 回答