안드로이드 개발 시 화면을 고정하는 경우 manifests 하위에 있는 AndroidManifest.xml 파일을 손봐야 한다.
화면 방향의 디폴트 값은 세로이니, 가로 환경으로 바꾸고 싶다면 아래 코드를 activity에 추가하면 된다.
android:screenOrientation="landscape"
코드를 추가한 AndroidManifest.xml의 전체 코드는 다음과 같다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.student.project0512"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity " android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> | cs |
만약 세로 환경으로 고정 하고 싶다면 landscape를 portrait로 변경해주면 된다.
layout 개발 화면에서 미리보기 기능을 제공하는 preview 화면에서는 아무리 화면을 가로로 눕혀도 포팅 시 반영이 되지 않음을 유의하자.
'문돌이의 IT > 안드로이드' 카테고리의 다른 글
안드로이드 암시적인텐트 Intent.ACTION_DIAL 전화걸기 기능구현 (0) | 2016.06.03 |
---|---|
안드로이드 앱 시장 분석 (2) | 2016.05.29 |
안드로이드스튜디오 어댑터뷰어(adapter viewer) ListView GridView Spinner (0) | 2016.05.27 |
안드로이드 LinearLayout 예제 (0) | 2016.05.25 |
안드로이드 RelativeLayout 예제(2) (0) | 2016.05.24 |