본문 바로가기
안드로이드 Development

[안드로이드] 회전 방지(가로, 세로 모드 설정)

by gnCompany 2022. 5. 8.

앱이 회전이 안되고 가로 or 세로 모드로 고정 하는 설정 방법

 

AndroidManifest.xml의 Activity의 android:screenOrientation의 속성을 설정 하면 됩니다.

 

1. 세로모드

android:screenOrientation = portrait

 

2. 가로 모드

android:screenOrientation = landscape

 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ggulcompany.testproject">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MaterialComponents.Light.NoActionBar.Bridge">
        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
반응형

댓글