안드로이드에서 화면회전이 안되게 할수있을까요?

조회수 4245회

발생하는 문제 및 실행환경

디바이스 :HTC Desire

제가 앱개발을 하고있는데요. landscape 모드까지 설계하긴 힘들어서 portrait모드만 가능하게 하고 싶은데요.

<application 
  android:debuggable="true"
  android:icon="@drawable/icon" 
  android:label="@string/app_name"
  android:screenOrientation="portrait">

그래서 매니페스트 파일에 이렇게 추가했는데 제 디바이스에서는 작동을 안하네요. 그래서 다른 사이트를 찾아보니까

<application 
  android:debuggable="true"
  android:icon="@drawable/icon" 
  android:label="@string/app_name"
  android:configChanges="orientation"       
  android:screenOrientation="portrait">

매니페스트파일에 저렇게 하고 액티비티 클래스에서 밑의 코드를 넣는건데

public void onConfigurationChanged(Configuration newConfig)
{
    super.onConfigurationChanged(newConfig);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

이렇게 해줘도 디바이스를 뒤집으면 가로모드됐다가 세로모드 됐다가 해요. 어떻게 고정하죠?

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)