屏幕方向设置为fullsensor在清单文件中出现错误。

3

我正在尝试开发一个能适用于四个方向的项目。我在AndroidManifest.xml中设置了android:screenOrientation="sensor",这可以工作,但只支持三种屏幕方向。因此,我将其设置为android:screenOrientation="fullSensor"以支持四个方向。不幸的是,我遇到了以下错误:

error: Error: String types not allowed (at 'screenOrientation' with value 
 'fullSensor').

有谁知道如何使这个工作起来吗?
2个回答

1
你正在使用哪个API级别? fullSensor 在API级别9中添加。请检查一下

我已经将API设置为9,但图像仍未完全翻转。手机(状态栏)是倒置的,但应用程序仍然没有翻转。 - antonoVodka

1

fullSensor仅支持API级别9及以上。

The orientation is determined by the device orientation sensor for any of the 4 orientations. This is similar to "sensor" except this allows any of the 4 possible screen orientations, regardless of what the device will normally do (for example, some devices won't normally use reverse portrait or reverse landscape, but this enables those). Added in API level 9.

请参考http://developer.android.com/guide/topics/manifest/activity-element.html

我已经将API设置为9,但图像仍未完全翻转。手机(状态栏)是倒置的,但应用程序仍然没有翻转。 - antonoVodka
你尝试过单独使用“sensorLandscape”或“sensorPortrait”吗? - user936414
我得到了这个错误信息:“错误:不允许使用字符串类型(在'value'为'sensorPortrait'的'screenOrientation'处)。" - antonoVodka
<uses-sdk android:minSdkVersion="10" /> 这个你在清单文件中声明了吗? - user936414

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接