기본 프로젝트를 만들고 실행하면 만든 프로젝트 이름으로 타이틀에 영역을 차지하는 부분이 있다.

이때 이부분을 없애려고 한다.

 

프로젝트를 생성 후 생기는 파일 중에 

AndroidManifest.xml에서 theme를 확인하고,

style.xml에서 <item name="windowNoTitle">true</item> 를 추가 해준다.

 

경로> 파일:

app> manifests> AndroidManifest.xml

 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myweb.myapp">

    <!--인터넷 연결(Access to the Internet)-->
    <uses-permission android:name="android.permission.INTERNET" />
    <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/AppTheme">
        <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>

 

여기서 android:theme="@style/AppTheme">는 AppTheme라고 정의해놓은 style을 쓰겠다는 의미이다.

 

 

경로> 파일:

app> res> values> styles.xml

 

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="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.xml은 html의 span과 같다고 보면 된다.(such as spans)

 

출처>

안드로이드 개발자 사이트

https://developer.android.com/guide/topics/ui/look-and-feel/themes

 

 

광고>

728x90

+ Recent posts