프로그램/Android

안드로이드 앱 타이틀바 감추기

로드러너 2014. 3. 18. 18:40

안드로이드 앱에서 타이틀바를 감추기 위해선 AndroidManifest.xml 파일에서 <application> 태그의 android:theme 속성의 값으로 @android:style/Theme.NoTitleBar 설정해 주면 가능하다.

 

<application

android:icon="@drawable/icon"

android:label="@string/app_name"

android:theme="@android:style/Theme.NoTitleBar" >

 

 

앱 전체가 아니고 특정 Activity 에 대해서만 타이틀 바를 감추고 싶으면 <activity> 태그의 android:theme 속성에 동일한 값을 적용해 주면 된다.

 

<activity

android:name="com.example.helloword.MainActivity"

android:label="@string/app_name"

android:theme="@android:style/Theme.NoTitleBar" >

 

 

Theme.NoTitleBar.Fullscreen

 

 

자바 코드상에서 타이틀을 제거하려면 Activity 의 onCreate() 메소드에 다음 코드를 삽입해 준다.

 

public void onCreate(Bundle savedInstanceState){

super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);

setContentView(R.layout.activity_main);

}

 

위 방법은 타이틀바가 있는 화면이 뜬 후에 타이틀 바를 제거해 준다.