1
2
3
4
<activity android:name="ActivityName"
   
 android:screenOrientation="portrait" //화면을 portrait(세로) 화면으로 고정하고 싶은 경우
 android:screenOrientation="landscape"> //화면을 landscape(가로) 화면으로 고정하고 싶은 경우
cs


1
2
3
4
5
6
7
8
9
10
11
12
13
@Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
         
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        // 화면을 portrait(세로) 화면으로 고정하고 싶은 경우
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        // 화면을 landscape(가로) 화면으로 고정하고 싶은 경우
         
        setContentView(R.layout.main);
        // setContentView()가 호출되기 전에 setRequestedOrientation()이 호출되어야 함
    }
cs


+ Recent posts