티스토리 뷰

반응형

Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.

Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.

 

아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

How can I disable landscape mode in Android?

안드로이드에서 가로 모드 비활성화 방법

 문제 내용 

How can I disable landscape mode for some of the views in my Android app?

안드로이드 앱에서 일부 뷰에 대해 가로 모드를 비활성화하려면 어떻게 해야 합니까?

 

 

 

 높은 점수를 받은 Solution 

Add android:screenOrientation="portrait" to the activity in the AndroidManifest.xml. For example:

AndroidManifest.xml의 액티비티에 Android:screenOrientation="portrait"을 추가합니다. 예:
<activity android:name=".SomeActivity"
          android:label="@string/app_name"
          android:screenOrientation="portrait" />

 

 

 

 가장 최근 달린 Solution 

Put it into your manifest.

매니페스트에 다음을 추가하세요.
<activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:screenOrientation="sensorPortrait" />

 

The orientation will be portrait, but if the user's phone is upside down, it shows the correct way as well. (So your screen will rotate 180 degrees.)

방향은 세로로 표시되지만 사용자의 전화기가 거꾸로 되어 있으면 올바른 방향도 표시됩니다(화면이 180도 회전합니다).

 


The system ignores this attribute if the activity is running in multi-window mode.

액티키티가 멀티 윈도우 모드에서 실행 중인 경우 시스템은 이 특성을 무시합니다.

 

More: https://developer.android.com/guide/topics/manifest/activity-element

추가 정보: https://developer.android.com/guide/topics/manifest/activity-element

 

 

 

출처 : https://stackoverflow.com/questions/582185/how-can-i-disable-landscape-mode-in-android

반응형
댓글
공지사항
최근에 올라온 글