Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
看到我有这个 android 应用程序,我有点使用元素的绝对定位来设计它,所以当我将手机旋转 90 度时,外观完全混乱。当我转动手机时,我如何强制我的应用程序不更改布局!
添加android:screenOrientation="portrait"到清单中的活动。
android:screenOrientation="portrait"
在您的情况下,最好的选择可能是只允许纵向。您可以使用以下定义在您的 AndroidManifest.xml 中执行此操作;
<activity android:name="com.example.SampleActivity" android:screenOrientation="portrait" />