简体   繁体   English

Android:锁定背景图片但旋转前景视图

[英]Android: Lock the Background image but rotate foreground views

I have a Landscape background image in place. 我有一个风景背景图像。 How do I lock it into position, but allow forground views to be rotated, eg a Dialog. 如何将其锁定到位,但如何旋转前景视图,例如对话框。

At the moment, either I lock the orientation so the dialog doesn't rotate, or I don't lock it and the background becomes tiny as I rotate the screen and it fills the narrow width of the screen. 此刻,要么我锁定方向以使对话框不旋转,要么我不锁定它,并且当我旋转屏幕时背景变得很小,并且它填充了屏幕的狭窄宽度。

I think your best bet would be to allow the rotation and just display a different background (the original background rotated 90 degrees) 我认为您最好的选择是允许旋转并仅显示不同的背景(原始背景旋转了90度)

You can catch the rotation in onConfigurationChanged, once you've added android:configChanges="orientation" to your activity in the manifest 将android:configChanges =“ orientation”添加到清单中的活动后,即可捕获onConfigurationChanged中的旋转

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM