고똘이의 IT 개발이야기

[ 안드로이드 action bar, title bar 없애기 ]



오늘은 안드로이드 액션 바, 타이틀 바를 없애는 법에 대해서 알려 드리려 합니다. 안드로이드 네이티브 앱을 만들때는 잘 쓰지 않지만 요새 하이브리드 앱을 만들 때 고객사의 요청으로인해 액션 바, 타이틀 바를 없애 달라는 곳이 있어 공유 드립니다.


1. res -> values -> styles.xml 파일을 열어 줍니다. 현재 기본 styles는 windowNoTitle,        android:windowFullscreen이 없습니다.

colorAccent 밑에  windowNoTitle, android:windowFullscreen 를 추가 해주시면 action bar와 title bar를 숨김 처리 해줄 수 있습니다.


1
2
3
4
5
6
7
8
9
10
   <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowNoTitle">true</item> <!-- 타이블 바 없애기 시계 밑에있는게 타이틀 바입니다. -->
        <item name="android:windowFullscreen">true</item> <!-- 풀 스크린으로 만들어 액션바 hide -->
    </style>
cs


이상입니다. 짧지만 유용 하셨다면 좋아요 한번씩 눌러 주시면 저에게 큰 힘이 됩니다.

감사합니다.

이 글을 공유합시다

facebook twitter googleplus kakaoTalk kakaostory naver band