开发者

Screen orientation in only one child of a ViewSwitcher in Android

开发者 https://www.devze.com 2023-01-30 11:06 出处:网络
I\'ve got a ViewSwitcher containing a LinearLayout in position 0, and an ImageView in position 1. Now I want the LinearLayout only to be shown as Portrait, and, when the ImageView is shown, give the

I've got a ViewSwitcher containing a LinearLayout in position 0, and an ImageView in position 1.

Now I want the LinearLayout only to be shown as Portrait, and, when the ImageView is shown, give the user the chance to rotate the device and see that view in Landscape mode.

So, I added android:configChanges="orientation" in the Activity in my AndroidManifest.xml file.

Then I need to override onConfigurationChanged (Configuration newConfig) in my Activity, but I can't find any way to get what I want...

I've tried editing newConfig.orientation param directly, before calling super.onConfigurationChanged(newConfig), and also creating a new开发者_C百科 Configuration from newConfig and using updateFrom method, but It doesn't work.

Any idea?

Thank you


include also keyboardhidden

          android:configChanges="orientation|keyboardHidden"
0

精彩评论

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

关注公众号