Android/Kotlin
[Kotlin] screenOrientation - 가로모드, 세로모드
eulBlue
2024. 3. 22. 14:10
📱테스트 환경
Samsung Galaxy Tab Advanced2
개발하는 도중 화면이 어떻게 보여야하는지 정할때가 있는데 그때 사용하는 것이 screenOrientation 이다.
<activity
android:name=".activity.MainActivity"
android:autoVerify = "true"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="landscape"
android:exported="true">
</activity>
이런식으로 landscape 를 적용해주면 가로모드로 고정된다.
이외에도 여러 옵션들이 있는데
- unspecified : 기본값
- portrait : 세로모드
- reverseLandscape : 가로모드 반대방향
- reversePortrait : 세로모드 반대방향
이외에도 여러 옵션이 있긴 하지만 이정도만 알고있어도 괜찮을것 같다는 생각이 있지만
필요한 옵션이 다르다면 더 찾아보면 많이 지원하니까 찾아보면 된다.