Android Activity 没有旋转到所有侧面?

发布于 2024-11-11 13:39:35 字数 819 浏览 5 评论 0原文

我有一项想要轮换的活动。我在 AndroidManifest.xml 中使用以下内容:

    <activity
        android:name=".MorburActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:screenOrientation="sensor">

        <intent-filter>
            <action
                android:name="android.intent.action.MAIN" />
            <category
                android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

因此,我说当设备旋转时屏幕方向应该改变。不,我看到了问题所在。当我在正常位置使用设备时(底部有按钮的纵向),它工作正常。另外将设备向右旋转,效果很好。活动被重新创建,所有内容都以不同的景观布局进行展示。

一切都很好,直到这里。但现在问题来了。当我将设备旋转到左侧或将其倒置时,它不会执行任何操作。该活动不会重新创建,也不会正确显示。

这可能是我手机的问题吗?我使用的是三星 Galaxy 5 Europe。或者我犯了一个编程错误?我无法在模拟器中测试这个。它只有两个对我有用的状态。

I have a activity that I want to rotate. I use the following in my AndroidManifest.xml:

    <activity
        android:name=".MorburActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:screenOrientation="sensor">

        <intent-filter>
            <action
                android:name="android.intent.action.MAIN" />
            <category
                android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

So, I say that the screen orientation should change when the device is rotated. No I see the problem. When I use my device in normal position (portrait with buttons on the bottom), it works fine. Also rotating the device to the right, it works fine. The activity is recreated and everything is displayed with a different layout made for landscape.

All good until here. But now comes the problem. When I rotate the device to the left of have it upside down, it doesn't do anything. The activity is not recreated and not displayed correctly.

Can this be a problem with my phone? I use a Samsung Galaxy 5 Europe. Or have I made a programming error? I can't test this in the emulator. It has only the two states that are working for me.

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

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

发布评论

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

评论(1

ˇ宁静的妩媚 2024-11-18 13:39:35

我的摩托罗拉 DEFY 只有 3 个旋转,我在 Android 默认网络浏览器中对其进行了测试,在垂直位置上它只有一个旋转,在水平位置上它有两个旋转..即使我不认为这些活动都有所有 3 个旋转,我认为它们只有垂直和水平旋转,两者各有一个。

my Motorola DEFY has only 3 rotations, I have test it in android default web browser, on the vertical position it has only one and on horizontal it has both rotations.. even though I don't think that the activities have all 3 rotations, I think they have only vertical and horizontal rotations, one for both..

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