我有一个为Honeycomb开发的应用程序(最初是3.0),在ICS发布后,用户可以将它安装到带有ICS的手机上,而不仅仅是平板电脑。我该如何过滤这些手机?我试过了<support-screens>
,但是没有用。另外一个有趣的(至少对我而言)我的应用程序不会缩小到较小的屏幕。我使用固定大小的控件,但大小是dp。
简而言之:
答案 0 :(得分:1)
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电子市场,使其能够在您的清单中http://developer.android.com/guide/topics/manifest/supports-screens-element.html的手机上安装此功能。
答案 1 :(得分:0)
您可以使用
进行检查if(Build.VERSION.SDK_INT >= 14) {
//ics
}
其中Build是android.os.Build类
答案 2 :(得分:0)
如果您只希望自己的应用在平板电脑市场中展示,请在AndroidManifest.xml中使用<support-screens>
属性(更多信息here)。确保在Honeycomb 3.2(x-large,large)和3.2+(600dp等)之前使用两个标识符。
你的意思是“我的应用程序不缩小”到底是什么意思?你能在这里提供更多信息吗?