开发者

Android: orientation change in landscape mode [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the开发者_如何学运维 help center. Closed 10 years ago.

When orientation changes in landscape mode, start a new activity. After back to this activity when orientation in portrait mode in Android.


Yes this the default behavior of any activity. If you want to stop this you can
- Set the activity asandroid:configChanges="orientation" Then Override the onConfigurationChanged like this

@Override
    public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);

    }

If you want to react to the changes refer this
Faster Screen Orientation Change,
Retaining an Object During a Configuration Change


In the Android Manifest file xml for your app place this code in there in the activity for the forms that you want. Each form will have its own activity and you can specify which ones that you want to have as landscape. Find the name for the activity listed ".name"

 <activity android:name=".name"
              android:label="@string/app_name"
              android:screenOrientation="landscape">
        <intent-filter>

The real key to this is make sure you specify screenOrientation="landscape"
this overrides the auto rotate sensor and it will not work for that screen.


I think that you can set only one orientation in your app so that you cannot change orientation like written in this Q&A

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜