상태 표시줄 숨기기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 과정에서는 여러 버전의 창에서 상태 표시줄을 숨기는 방법에 대해 설명합니다.
Android 상태 표시줄 (선택적으로 탐색 메뉴 포함)을 숨기면
콘텐츠가 디스플레이 공간을 더 많이 사용하므로 더 몰입도 높은 사용자 환경을 제공합니다.
그림 1은 상태 표시줄이 표시된 앱을 보여줍니다.
그림 1. 상태 표시줄 표시됨.
그림 2는 상태 표시줄이 숨겨진 앱을 보여줍니다. 작업 표시줄도 숨겨졌습니다.
상태 표시줄이 없으면 작업 모음을 표시할 수 없습니다.
그림 2. 상태 표시줄 숨겨짐.
Android 4.0 이하에서 상태 표시줄 숨기기
Android 4.0 (API 수준 14) 이하에서는
WindowManager
플래그. 이 작업은 프로그래매틱 방식으로 하거나
앱의 매니페스트 파일에서 활동 테마를 설정할 수 있습니다. 앱의
매니페스트 파일을 사용하는 것이 좋습니다.
숨겨진 경우도 있습니다 (엄격히 말하면 프로그래매틱 방식으로
사용할 수 있습니다. 예를 들면 다음과 같습니다.
<application
...
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
...
</application>
활동 테마를 사용하면 다음과 같은 장점이 있습니다.
- 프로그래밍 방식으로 플래그를 설정하는 것보다 유지 관리가 쉽고 오류가 적음.
- 필요한 정보가 시스템에 있으므로 UI 전환이 더 매끄러워집니다.
을 사용하여 앱의 기본 활동을 인스턴스화하기 전에 UI를 렌더링합니다.
프로그래매틱 방식으로 WindowManager
플래그를 설정할 수도 있습니다.
이 접근 방식을 사용하면 사용자가 상호작용할 때 더 쉽게 상태 표시줄을 숨기고 표시할 수 있습니다.
앱:
Kotlin
class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// If the Android version is lower than Jellybean, use this call to hide
// the status bar.
if (Build.VERSION.SDK_INT < 16) {
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN)
}
setContentView(R.layout.activity_main)
}
...
}
자바
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// If the Android version is lower than Jellybean, use this call to hide
// the status bar.
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
setContentView(R.layout.activity_main);
}
...
}
활동 테마를 통하거나WindowManager
앱에서 플래그를 지우지 않는 한 플래그가 계속 적용됩니다.
이때
FLAG_LAYOUT_IN_SCREEN
이 기능을 사용 설정했을 때와 동일한 화면 영역을 사용하도록 활동 레이아웃을 설정할 수 있습니다.
FLAG_FULLSCREEN
입니다. 이렇게 하면
상태 표시줄이 숨겨지거나 표시될 때 콘텐츠의 크기가 조절되지 않습니다.
Android 4.1 이상에서 상태 표시줄 숨기기
Android 4.1 (API 수준 16) 이상에서 다음과 같은 방법으로 상태 표시줄을 숨길 수 있습니다.
setSystemUiVisibility()
사용.
setSystemUiVisibility()
는
개별 보기 수준 이러한 설정은 창 수준에 집계됩니다. 사용
setSystemUiVisibility()
: UI 플래그 설정
시스템 표시줄을 보다 세밀하게 제어할 수 있습니다.
WindowManager
플래그. 다음은 상태 표시줄을 숨기는 스니펫입니다.
Kotlin
// Hide the status bar.
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
actionBar?.hide()
자바
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
ActionBar actionBar = getActionBar();
actionBar.hide();
다음 내용을 참고하세요.
콘텐츠를 상태 표시줄 뒤에 표시
Android 4.1 이상에서는 애플리케이션의 콘텐츠가
그러면 상태 표시줄이 숨겨지거나 표시될 때 콘텐츠 크기가 조정되지 않습니다.
이렇게 하려면
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
또한
SYSTEM_UI_FLAG_LAYOUT_STABLE
를 사용하면
레이아웃입니다.
이 접근 방식을 사용할 때는
(예: 지도 애플리케이션의 내장 컨트롤)가 작동하지 않는 경우
시스템 표시줄에 가려집니다. 가려지면 앱을 사용하지 못하게 될 수 있습니다. 대부분의 경우
XML 레이아웃 파일에 android:fitsSystemWindows
속성을 추가하고
true
입니다. 이렇게 하면 상위 요소 ViewGroup
의 패딩이 조정됩니다.
시스템 창을 위한 공간을 남겨둡니다. 대부분의 애플리케이션에서는 이렇게 하면 충분합니다.
그러나 경우에 따라 원하는 결과를 얻기 위해 기본 패딩을 수정해야 할 수도 있습니다.
설계할 것입니다. 배포 방식을 직접 조작하는 것은
콘텐츠는 창의 표시줄이라고 하는 공간을 차지하는 시스템 표시줄을 기준으로 표시됩니다.
'콘텐츠 인셋')에서 fitSystemWindows(Rect insets)
를 재정의합니다.
fitSystemWindows()
메서드는
창의 콘텐츠 인셋이 변경되면 뷰 계층 구조를 변경하여 창이
적절하게 조정할 수 있습니다 이 메서드를 재정의하면
인셋 (따라서 앱의 레이아웃)도 가능합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Hide the status bar\n\nThis lesson describes how to hide the status bar on different versions of\nAndroid. Hiding the status bar (and optionally, the navigation bar) lets the\ncontent use more of the display space, thereby providing a more immersive user experience.\n\n\nFigure 1 shows an app with a visible status bar:\n\n**Figure 1.** Visible status bar.\n\n\nFigure 2 shows an app with a hidden status bar. Note that the action bar is hidden too.\nYou should never show the action bar without the status bar.\n\n**Figure 2.** Hidden status bar.\n\nHide the Status Bar on Android 4.0 and Lower\n--------------------------------------------\n\nYou can hide the status bar on Android 4.0 (API level 14) and lower by setting\n[WindowManager](/reference/android/view/WindowManager) flags. You can do this programmatically or by\nsetting an activity theme in your app's manifest file. Setting an activity theme in your app's\nmanifest file is the preferred approach if the status bar should always remain\nhidden in your app (though strictly speaking, you could programmatically override the\ntheme if you wanted to). For example: \n\n```xml\n\u003capplication\n ...\n android:theme=\"@android:style/Theme.Holo.NoActionBar.Fullscreen\" \u003e\n ...\n\u003c/application\u003e\n```\n\nThe advantages of using an activity theme are as follows:\n\n- It's easier to maintain and less error-prone than setting a flag programmatically.\n- It results in smoother UI transitions, because the system has the information it needs to render your UI before instantiating your app's main activity.\n\n\nAlternatively, you can programmatically set [WindowManager](/reference/android/view/WindowManager) flags.\nThis approach makes it easier to hide and show the status bar as the user interacts with\nyour app: \n\n### Kotlin\n\n```kotlin\nclass MainActivity : Activity() {\n\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n // If the Android version is lower than Jellybean, use this call to hide\n // the status bar.\n if (Build.VERSION.SDK_INT \u003c 16) {\n window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,\n WindowManager.LayoutParams.FLAG_FULLSCREEN)\n }\n setContentView(R.layout.activity_main)\n }\n ...\n}\n```\n\n### Java\n\n```java\npublic class MainActivity extends Activity {\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n // If the Android version is lower than Jellybean, use this call to hide\n // the status bar.\n if (Build.VERSION.SDK_INT \u003c 16) {\n getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,\n WindowManager.LayoutParams.FLAG_FULLSCREEN);\n }\n setContentView(R.layout.activity_main);\n }\n ...\n}\n```\n\nWhen you set [WindowManager](/reference/android/view/WindowManager) flags (whether through an activity theme or\nprogrammatically), the flags remain in effect unless your app clears them.\n\nYou can use\n[FLAG_LAYOUT_IN_SCREEN](/reference/android/view/WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN)\nto set your activity layout to use the same screen area that's available when you've enabled\n[FLAG_FULLSCREEN](/reference/android/view/WindowManager.LayoutParams#FLAG_FULLSCREEN). This prevents your\ncontent from resizing when the status bar hides and shows.\n\nHide the Status Bar on Android 4.1 and Higher\n---------------------------------------------\n\nYou can hide the status bar on Android 4.1 (API level 16) and higher by\nusing [setSystemUiVisibility()](/reference/android/view/View#setSystemUiVisibility(int)).\n[setSystemUiVisibility()](/reference/android/view/View#setSystemUiVisibility(int)) sets UI flags at\nthe individual view level; these settings are aggregated to the window level. Using\n[setSystemUiVisibility()](/reference/android/view/View#setSystemUiVisibility(int)) to set UI flags\ngives you more granular control over the system bars than using\n[WindowManager](/reference/android/view/WindowManager) flags. This snippet hides the status bar: \n\n### Kotlin\n\n```kotlin\n// Hide the status bar.\nwindow.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN\n// Remember that you should never show the action bar if the\n// status bar is hidden, so hide that too if necessary.\nactionBar?.hide()\n```\n\n### Java\n\n```java\nView decorView = getWindow().getDecorView();\n// Hide the status bar.\nint uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;\ndecorView.setSystemUiVisibility(uiOptions);\n// Remember that you should never show the action bar if the\n// status bar is hidden, so hide that too if necessary.\nActionBar actionBar = getActionBar();\nactionBar.hide();\n```\n\nNote the following:\n\n- Once UI flags have been cleared (for example, by navigating away from the activity), your app needs to reset them if you want to hide the bars again. See [Responding to UI Visibility Changes](/training/system-ui/visibility) for a discussion of how to listen for UI visibility changes so that your app can respond accordingly.\n- Where you set the UI flags makes a difference. If you hide the system bars in your activity's [onCreate()](/reference/android/app/Activity#onCreate(android.os.Bundle)) method and the user presses Home, the system bars will reappear. When the user reopens the activity, [onCreate()](/reference/android/app/Activity#onCreate(android.os.Bundle)) won't get called, so the system bars will remain visible. If you want system UI changes to persist as the user navigates in and out of your activity, set UI flags in [onResume()](/reference/android/app/Activity#onResume()) or [onWindowFocusChanged()](/reference/android/view/Window.Callback#onWindowFocusChanged(boolean)).\n- The method [setSystemUiVisibility()](/reference/android/view/View#setSystemUiVisibility(int)) only has an effect if the view you call it from is visible.\n- Navigating away from the view causes flags set with [setSystemUiVisibility()](/reference/android/view/View#setSystemUiVisibility(int)) to be cleared.\n\n\u003cbr /\u003e\n\nMake Content Appear Behind the Status Bar\n-----------------------------------------\n\nOn Android 4.1 and higher, you can set your application's content to appear behind\nthe status bar, so that the content doesn't resize as the status bar hides and shows.\nTo do this, use\n[SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN](/reference/android/view/View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN).\nYou may also need to use\n[SYSTEM_UI_FLAG_LAYOUT_STABLE](/reference/android/view/View#SYSTEM_UI_FLAG_LAYOUT_STABLE) to help your app maintain a\nstable layout.\n\nWhen you use this approach, it becomes your responsibility to ensure that critical parts\nof your app's UI (for example, the built-in controls in a Maps application) don't end up\ngetting covered by system bars. This could make your app unusable. In most cases you can\nhandle this by adding the `android:fitsSystemWindows` attribute to your XML layout file, set to\n`true`. This adjusts the padding of the parent [ViewGroup](/reference/android/view/ViewGroup)\nto leave space for the system windows. This is sufficient for most applications.\n\nIn some cases, however, you may need to modify the default padding to get the desired\nlayout for your app. To directly manipulate how your\ncontent lays out relative to the system bars (which occupy a space known as the window's\n\"content insets\"), override [fitSystemWindows(Rect insets)](/reference/android/view/View#fitSystemWindows(android.graphics.Rect)).\nThe [fitSystemWindows()](/reference/android/view/View#fitSystemWindows(android.graphics.Rect)) method is called by the\nview hierarchy when the content insets for a window have changed, to allow the window to\nadjust its content accordingly. By overriding this method you can handle the\ninsets (and hence your app's layout) however you want."]]