无法使用 android:xlargeScreens="true" 吗?

发布于 2024-11-28 05:57:43 字数 2555 浏览 1 评论 0 原文

我正在为手机制作应用程序,但我不希望它们可以在平板电脑上使用。我不知道为什么不能。我在我的 android 清单文件中使用它:

android:xlargeScreens="true"

我收到此错误:

错误:在包“android”中找不到属性“xlargeScreens”的资源标识符

这是我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="cro.perger.bonbon"
      android:versionCode="5"
      android:versionName="1.4">
    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".bonbon"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

            <!-- Broadcast Receiver that will process AppWidget updates -->
        <receiver android:name=".HelloWidget" android:label="@string/w_name">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                </intent-filter>
        <meta-data android:name="android.appwidget.provider"
            android:resource="@xml/hello_widget_provider" />
        </receiver>

        <receiver android:name=".SMSReceiver">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>    

        </application>
        <supports-screens android:resizeable="true"
                      android:smallScreens="true"
                      android:normalScreens="true"
                      android:largeScreens="true"
                      android:xlargeScreens="true"
                      android:anyDensity="true"/>
    <uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
    <uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
    <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission> 
    <uses-permission android:name="android.permission.READ_SMS"/>
</manifest>

我应该怎么办?

I am making app for phones, but I wan’t them to be usable on tablets. I don’t know why can’t. I use this in my android manifest file:

android:xlargeScreens="true"

I get this error:

error: No resource identifier found for attribute 'xlargeScreens' in package 'android'

This is my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="cro.perger.bonbon"
      android:versionCode="5"
      android:versionName="1.4">
    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".bonbon"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

            <!-- Broadcast Receiver that will process AppWidget updates -->
        <receiver android:name=".HelloWidget" android:label="@string/w_name">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                </intent-filter>
        <meta-data android:name="android.appwidget.provider"
            android:resource="@xml/hello_widget_provider" />
        </receiver>

        <receiver android:name=".SMSReceiver">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>    

        </application>
        <supports-screens android:resizeable="true"
                      android:smallScreens="true"
                      android:normalScreens="true"
                      android:largeScreens="true"
                      android:xlargeScreens="true"
                      android:anyDensity="true"/>
    <uses-permission android:name="android.permission.SEND_SMS"></uses-permission>
    <uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
    <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission> 
    <uses-permission android:name="android.permission.READ_SMS"/>
</manifest>

What should I do?

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

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

发布评论

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

评论(7

身边 2024-12-05 05:57:43

请检查您的项目构建目标 为了支持 xlarge 屏幕,您的项目构建目标至少应为 android 2.3.3 adk。

在 Eclipse 中 -?右键单击项目 ->属性->安卓->选择 Project Build Tagrget 为 2.3.3 或更高版本

Please check your project Build Target To support xlarge screen your project build target should be atleast android 2.3.3 adk.

In Eclipse -?right click on project -> Properties -> Android -> Select Project Build Tagrget as 2.3.3 or onwards

公布 2024-12-05 05:57:43

我的应用程序支持 android 版本 1.5 到最新版本,这是我的清单中的内容:

<supports-screens
      android:largeScreens="true"
      android:normalScreens="true"
      android:smallScreens="true"
      android:anyDensity="true" />

这是我的应用程序的 android 市场开发人员网站上显示的内容:

Screen layouts: SMALL NORMAL LARGE XLARGE
Required device features
        android.hardware.touchscreen
This application is available to over 555 devices.

此外,我的项目构建目标是 2.3.3,但我仍然有许多安装在运行 android 3.0 的设备上

这只是一个猜测,我对此不确定,但不会包括像 CALL_PHONE 这样的权限从平板电脑上的搜索中过滤您的应用程序,因为它们没有该功能?

My application supports android versions 1.5 to the latest version and this is what I have in my manifest:

<supports-screens
      android:largeScreens="true"
      android:normalScreens="true"
      android:smallScreens="true"
      android:anyDensity="true" />

This is what shows up on the android market developer site for my app:

Screen layouts: SMALL NORMAL LARGE XLARGE
Required device features
        android.hardware.touchscreen
This application is available to over 555 devices.

Also, my project build target is 2.3.3, but I still have many installs on devices running android 3.0

And this is just a guess, im not sure about this, but wouldn't including permissions like CALL_PHONE filter your application from search on a tablet since they dont have that feature?

初与友歌 2024-12-05 05:57:43

看起来您需要为旧版本和新版本构建不同的 APK。查看发布在 http://android-developers.blogspot.com/search 上的博客/label/Android%20Market 关于多 APK 支持:“多 APK 支持为您提供了多种控制应用分发的方式。例如,您可以使用它在同一产品列表下为手机和平板电脑创建单独的 APK ”。

It looks like you need to build different APKs for older and new versions. Checkout out the blog posted on http://android-developers.blogspot.com/search/label/Android%20Market about multiple APK support: "Multiple APK support gives you a variety of ways to control app distribution. For example, you could use it to create separate APKs for phones and tablets under the same product listing."

卷耳 2024-12-05 05:57:43

您需要至少使用 Android API Level 9 才能在 AndroidManifest.xml 中识别 android:xlargeScreens

为此,请确保您的 default.properties 文件中有 target=android-9 或更高版本。这也可以使用 Android 部分中的项目属性进行设置。

You need to use at least android API Level 9 for android:xlargeScreens to be recognized in AndroidManifest.xml.

For this make sure in your default.properties file you have target=android-9 or higher. This also can be set using Project Properties, in Android section.

云淡月浅 2024-12-05 05:57:43

问题出在你的 minSdkVersion 上。

xlargeScreens 属性是在 API 级别 9 中引入的。由于您指定您的应用程序可能会在 API 级别 4 下运行,因此 android 无法找到此属性。

minSdkVersion 属性更改为 11 它应该可以工作。

您设置为 11targetSdkVersion 属性仅表明该应用程序是针对此版本开发的(因此是“推荐”),但 minSdkVersion 指定最低 API 级别,请参阅 这里

The problem is your minSdkVersion.

The xlargeScreens-attribute was introduced in API-Level 9. Since you specified that your application will probably run under API-Level 4, android can't find this attribute.

Change the minSdkVersion-attribute to 11 and it should work.

The targetSdkVersion-attribute, which you set to be 11 only indicates that the App was developed to target this version (so it's "recommended"), but the minSdkVersion specifies the minimum API-Level, see here.

野味少女 2024-12-05 05:57:43

您的 API 级别设置为多少?文档中说它需要 API 9 或更高版本。 9是2.3。请参阅链接,其中显示:

android:xlargeScreens 指示应用程序是否支持额外的
大屏幕外形尺寸。 xlarge 屏幕被定义为屏幕
比“大”屏幕(例如平板电脑)大得多
(或更大的东西)并且可能需要特别注意
应用程序的一部分来充分利用它,尽管它可能依赖于
由系统调整大小以填满屏幕。这个的默认值
实际上,某些版本之间有所不同,因此最好
始终显式声明此属性。设置时要注意
“false”通常会启用屏幕兼容模式。这
属性是在 API 级别 9 中引入的。

What is your API level set to? It says in the documentation that it requires API 9 or higher. 9 is 2.3. See this link which says:

android:xlargeScreens Indicates whether the application supports extra
large screen form-factors. An xlarge screen is defined as a screen
that is significantly larger than a "large" screen, such as a tablet
(or something larger) and may require special care on the
application's part to make good use of it, though it may rely on
resizing by the system to fill the screen. The default value for this
actually varies between some versions, so it's better if you
explicitly declare this attribute at all times. Beware that setting it
"false" will generally enable screen compatibility mode. This
attribute was introduced in API level 9.

贪恋 2024-12-05 05:57:43

android:xlargeScreens :
This attribute was introduced in API level 9 (Android 2.3.3). If you have your build target lesser than API level 9, then you will get error "No resource identifier found for attribute 'xlargeScreens' in package 'android"
Set your build target to API level 9 or above and this error will vanish.

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