본문 바로가기

프로그래밍/안드로이드(Android)

[Android] Shade효과 제거하기

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


위 이미지를 보고 왼쪽과 오른쪽의 차이가 보이는가??

title영역 아래에 보면 shade효과가 적용되어있는 것과 적용되지 않는 것을 볼 수있다.
기본으로 어플을 개발하면 shade효과가 적용된 상태이다.
하지만 어플을 개발하다보면 shade효과를 빼야 할 경우가 종종있다
그렇다면 빼보도록 하자!

우선 style.xml을 만들어야한다.
res/values/ 아래에 style.xml을 만들어 준다.
소스는 다음과 같다.

<?xml version="1.0" encoding="UTF-8"?>
<resources>
 <style name="Theme.NoShade" parent="android:Theme">
     <item name="android:windowContentOverlay">@null</item>
  </style>
</resources>

만들었다면 이제 style 을 적용하자!!
AndroidMainfest.xml엘에 빨간색으로 표시한 부분을 추가한다.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="
http://schemas.android.com/apk/res/android"
      package="com.kkomanjell.noshade"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name"
     android:theme="@style/Theme.NoShade">
        <activity android:name=".NoShade"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

추가했다면 어플을 실행해보자.
shade효과가 빠진것을 볼 수 있을 것이다.

참고로 style.xml은 어플의 style을 지정할 수 있다.
shade를 빼는 것이외에도 많은 속성을 줄 수있다.

AndroidMainfest에서 title영역을 뺄 수도 있지만 style.xml을 이용해서 뺄 수도있다.
다음과 소스를 style에 추가해보고 실행해 보자.

<item name="android:windowNoTitle">true</item>

그럼 두가지 효과가 적용된것을 확인 할 수있다.



모두들 참고하시길!!!