본문 바로가기
Android Studio/개발

[Android Studio/안드로이드 스튜디오] 액티비티 화면 가로, 세로 고정하기

by ewaterland 2024. 9. 22.

AndroidManifdest.xml 에서 화면을 가로 또는 세로로 고정하는 방법이다.

화면을 고정하고 싶은 액티비티마다 screenOrientation 속성을 추가해주어야 한다.

 

android:name 의 MyActivity 칸에는 자신의 액티비티 이름을 작성해주면 된다.

(이 부분은 기본으로 작성되어 있으니 지우고 사용해도 된다.)

 

1. 가로로 고정하기

<activity
    android:name="MyActivity"
    android:screenOrientation="landscape">
</activity>

 

2. 세로로 고정하기

<activity
    android:name="MyActivity"
    android:screenOrientation="portrait"></activity>