设计一个Android平板电脑专用应用程序

Jim*_*m S 31 android android-layout google-play

假设我想构建2组不同的平板电脑布局.一个600dp(7"平板电脑1024x600)和一个720dp(10"平板电脑1280x720或1280x800)

据我所知,使用android 3.2,您现在可以指定平板电脑布局.我理解但是如何在Google Play上指定这是一款仅限平板电脑的应用.

有这个android:requiresSmallestWidthDp来指定所需的最小tinyWidth.很好,但后来你可以阅读指南

注意:Android系统不关注此属性,因此它不会影响应用程序在运行时的行为方式.相反,它用于为您的应用程序启用Google Play等服务的过滤功能.但是,Google Play目前不支持此属性进行过滤(在Android 3.2上),因此如果您的应用程序不支持小屏幕,则应继续使用其他大小属性.

所以它没有被系统使用而且没有被Google Play使用......所以基本上它没用,对吧?

"如果您的应用程序不支持小屏幕,您应该继续使用其他大小属性.

好.还有什么尺寸属性?支持屏幕一个?Xlarge:屏幕至少为960dp x 720dp大:屏幕至少为640dp x 480dp

1024x600 7"平板电脑是一个"大"屏幕.所以我基本上必须为640x480 res设计一个布局,因为如果我想让我的应用程序可用于2种不同尺寸的平板电脑,我必须启用大型和xlarge屏幕.

所以我想我可以构建两组不同的布局

res/layout-sw600dp/main_activity.xml   # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml   # For 10” tablets (720dp wide and bigger)
Run Code Online (Sandbox Code Playgroud)

并完全省略为较小的屏幕指定布局,但随后应用程序将在较小的屏幕上崩溃.这是一种阻止应用程序运行的方法,确保不优雅.

有没有办法让应用程序仅适用于Google-Play上的600dp和更高屏幕?我很困惑.我想制作一款仅限平板电脑的应用,即640x480手机无法在Google Play上下载.我想我错过了一些非常明显的东西.

Blu*_*ell 50

要让您的应用仅针对在Google Play中运行ICS的平板电脑进行过滤,您可以在AndroidManifest中执行以下操作:

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

 <uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="14" />
Run Code Online (Sandbox Code Playgroud)

要获得HoneyComb平板电脑,您只需更改您的minSdk即可

 <uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="14" />
Run Code Online (Sandbox Code Playgroud)

因此,您现在说姜饼(2.3)及以下版本无法下载您的应用程序(因为它们不是平板电脑,也不是设计用于平板电脑,即使它被黑客入侵).

支持HoneyComb平板电脑(3.0)(因为<3.2忽略了requiresSmallestWidth属性)

没有电话运行蜂窝

支持ICS平板电脑,因为它会查看您的smallestWidth属性

最后ICS手机不是因为我们说ICS使用了smallestWidth属性