设计一个仅限安卓平板电脑的应用程序 [英] Designing an android tablet-only app

查看:29
本文介绍了设计一个仅限安卓平板电脑的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Let's say that I want to build 2 different sets of tablet-only layouts. One for 600dp (7" tablet 1024x600) and one for 720dp (10" tablet 1280x720 or 1280x800)

我知道在 android 3.2 中,您现在可以指定平板电脑布局.我明白这一点,但如何在 Google Play 上指明这是一款仅限平板电脑的应用.

I understand that with android 3.2 you can now specify the tablet layouts. I understand that but how to specify on Google Play that this is a tablet-only app.

有这个 android:requiresSmallestWidthDp 来指定所需的最小最小宽度.很好,但稍后您可以在指南中阅读

There is this android:requiresSmallestWidthDp to specify the minimum smallestWidth required. Fine but later on the guide you can read

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

Caution: The Android system does not pay attention to this attribute, so it does not affect how your application behaves at runtime. Instead, it is used to enable filtering for your application on services such as Google Play. However, Google Play currently does not support this attribute for filtering (on Android 3.2), so you should continue using the other size attributes if your application does not support small screens.

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

So it's not used by the system and not used by Google Play...so basically it's useless ,right ?

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

"You should continue using the other size attributes if your application does not support small screens.

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

Ok. What other size attribute? The supports-screens one ? Xlarge : screens are at least 960dp x 720dp large : screens are at least 640dp x 480dp

1024x600 7" 平板电脑是大"屏幕.所以我基本上必须为 640x480 分辨率设计一个布局.也是因为如果我希望我的应用适用于 2 种不同尺寸的平板电脑,我必须启用大屏幕和超大屏幕.

The 1024x600 7" tablet is a "large" screen. So I basically have to design a layout for the 640x480 res. too because if I want my app to be available for the 2 different sizes of tablets, I have to enable large and xlarge screens.

所以我想我可以像这样构建 2 组不同的布局

So I guess that I could build 2 different sets of layouts like this

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)

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

and completely omit to specify a layout for smaller screens but then the app would crash on a smaller screen. That's a way to prevent the app from running that sure is not elegant.

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

Is there a way to make the app available only for the 600dp and greater screens on Google-Play? I'm quite confused. I want to make a tablet-only app that a 640x480 phone could not download on Google-Play. I guess I'm missing something very obvious.

推荐答案

为了让您的应用程序仅过滤在 Google-Play 中运行 ICS 的平板电脑您可以在 AndroidManifest 中执行此操作:

To get your app filtered for just Tablets running ICS in Google-Play you would do this in your 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" />

要获得 HoneyComb Tablets 以及您只需更改您的 minSdk

To get HoneyComb Tablets aswell you simply change your minSdk

 <uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="14" />

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

Therefore your now saying Gingerbread (2.3) and below can't download your app (because they are not Tablets nor designed to work on tablets even if it is hacked in).

支持 HoneyComb Tablets (3.0)(因为 <3.2 忽略了 requiresSmallestWidth 属性)

HoneyComb Tablets (3.0) is supported (because <3.2 is ignoring the requiresSmallestWidth attribute)

没有手机运行蜂窝

支持 ICS 平板电脑,因为它确实查看您的 minimumWidth 属性

ICS Tablets are supported because it does look at your smallestWidth attribute

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

and finally ICS phones aren't because as we say ICS uses the smallestWidth attribute

这篇关于设计一个仅限安卓平板电脑的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆