처음으로 emulater로 build하면 다음과 같은 화면을 볼 수 있다.

 

뭔가 되게 보기 싫게 생겼다...

맨 위에 "test1" 이라고 적힌 곳이 타이틀바 이다.

나는 어플을 만들때 타이틀바가 필요없으므로 지워야한다.

 

방법은 간단하게 2가지 정도가 있다.

 

 

 

 

 

 

 

 

1. style.xml 에서 windowNoTiltle 속성 추가하기.

<!-- res\values\style.xml 에 들어가서 windowNoTitle 속성을 true로 추가한다. -->

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="windowNoTitle">true</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources>

 

이건 정말 여러번 써봤는데, 이 style 속성 하나 때문에 오류가 난 적이 한 둘이 아니었다.

에뮬레이터 실행시 어플이 바로 종료되거나 하는 문제가 발생할때가 있다... (원인모름)

가끔 안먹을때도 있던데...

 

 

2. Manifest.xml 에서 NoActionBar 속성 추가하기. (타이틀바+액션바 둘 다 사라진다.)

<!-- Manifext.xml 파일에 android:theme="@style/Theme.AppCompat.NoActionBar" 속성을 추가한다.-->

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.NoActionBar">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

 

 

+) 실행결과

 

2번째 방법으로 해보면, 이런 결과가 나온다.

full screen이 된다.

+ Recent posts