> 주제
모든 페이지가 아니라 특정 페이지의 화면을 세로 화면으로 강제 유지하기
> 환경
OS:
Windows 10 Home
안드로이드 스튜디오 버전:
Android Studio Chipmunk | 2021.2.1
> 방법
AndroidManifest.xml 파일에서
세로 화면으로 보고싶은 화면의 android:screenOrientation을 portrait로 설정한다.
그러면 해당 화면으로 이동 시 세로 화면으로 전환한다.
android:screenOrientation="portrait"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.myhome.myproject">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:targetApi="31">
<activity
android:name=".PortraitActivity"
android:exported="false"
android:screenOrientation="portrait" />
> 관련글
[안드로이드(Android)] - [Android] 페이지 가로(수평) 화면으로 강제 유지하기
> 참고
https://developer.android.com/guide/topics/manifest/activity-element
'Android(안드로이드)' 카테고리의 다른 글
[Android] 리스트에서 길게 누름 적용하기 - setOnLongClickListener (0) | 2023.08.06 |
---|---|
[Android] LinearLayout안에 동적 뷰 만들기 - weight, margin (0) | 2022.11.15 |
[Android] 기본 배경색 (0) | 2022.11.13 |
[Android] TextView에서 가로(수평)선 그리기 (0) | 2022.11.06 |
[Android] 페이지 가로(수평) 화면으로 강제 유지하기 (0) | 2022.11.03 |