在 ICS(冰淇淋三明治)上运行的 Android Honeycomb 应用程序

发布于 2024-12-26 22:58:03 字数 356 浏览 1 评论 0原文

我有一个为 Honeycomb(最初为 3.0)开发的应用程序,在 ICS 发布后,用户可以将其安装到带有 ICS 的手机上,而不仅仅是平板电脑上。如何过滤这些电话?我尝试过 但这不起作用。还有一个有趣的事情(至少对我来说),我的应用程序不会缩小到较小的屏幕。我使用固定大小的控件,但大小以 dp 为单位。

简而言之:

  1. 有人知道如何过滤 ICS 电话吗? (最好来自代码)
  2. 我应该怎样做才能支持 ICS 电话? (我想我需要为 ICS 手机实现全新的布局,但对我来说仍然是一个问题,如何确定它是哪种设备,是手机还是平板电脑?

I have an application developed for Honeycomb (initially 3.0) and after the ICS is released the users can install it to theirs phones with ICS, not just to tablets. How can I filter these phones? I have tried with the <support-screens> but that is not working. Also an interesting (at least to me) thing my application won't scale down to smaller screens. I used fixed sized controls but the size is in dp.

In short:

  1. Somebody knows how can I filter the ICS phones? (preferably from code)
  2. What should I do to support ICS phones? (I guess I need to implement a whole new layout for the ICS phones, but it is still a question to me how can I determine what kind of device is it, phone or tablet?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

为人所爱 2025-01-02 22:58:03
public static boolean isHoneycomb() {
    // Can use static final constants like HONEYCOMB, declared in later versions
    // of the OS since they are inlined at compile time. This is guaranteed behavior.
    return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}

public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK)
            >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

public static boolean isHoneycombTablet(Context context) {
    return isHoneycomb() && isTablet(context);
}

从此答案复制: https://stackoverflow.com/a/8427523/253583

您可能还想限制Android Market 允许用户通过 http://developer.android.com/guide/topics/manifest/supports-screens-element.html 在清单中。

public static boolean isHoneycomb() {
    // Can use static final constants like HONEYCOMB, declared in later versions
    // of the OS since they are inlined at compile time. This is guaranteed behavior.
    return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}

public static boolean isTablet(Context context) {
    return (context.getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK)
            >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

public static boolean isHoneycombTablet(Context context) {
    return isHoneycomb() && isTablet(context);
}

Copied from this answer here: https://stackoverflow.com/a/8427523/253583

You will also probably want to restrict Android Market from enabling users to install this on phones with http://developer.android.com/guide/topics/manifest/supports-screens-element.html in your manifest.

╰つ倒转 2025-01-02 22:58:03

您可以使用

if(Build.VERSION.SDK_INT >= 14) {
    //ics
}

Build 是 android.os.Build 类来检查

You can check using

if(Build.VERSION.SDK_INT >= 14) {
    //ics
}

where Build is android.os.Build class

各空 2025-01-02 22:58:03

如果您只想在平板电脑市场中显示您的应用程序,请在 AndroidManifest.xml 中使用 属性(更多信息 此处)。确保在 Honeycomb 3.2(x-large、large)和 3.2+(600dp 等)之前使用两个标识符。

“我的应用程序没有缩小规模”到底是什么意思?您能在这里提供更多信息吗?

If you only want your app being shown in the Market for tablets, in your AndroidManifest.xml use the <support-screens> attribute (more info here). Make sure you use both indentifiers for before Honeycomb 3.2 (x-large, large) and 3.2+ (600dp etc).

And what exactly do you mean by "my app doesn't scale down"? Could you give more information here?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文