본문 바로가기
소소한 개발 꿀팁

[Android]안드로이드 개발시 다크 모드 무시/해제 하기

by 지게요 2022. 3. 1.
728x90
반응형

이번에는 안드로이드 개발을 하다 보면 다크 모드가 자동으로 지원돼서 프로젝트가 생성이 된다.

다크 모드를 지원하지 않으려면 아래처럼 따라 하면 된다.

 

# 해결방법

res -> values -> themes -> themes.xml(night) 파일을 수정하면 된다.

 

수정 전 코드

<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.DataBinding_EX" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
        ● ● ●
    </style>
</resources>​

수정 후 코드

<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.DataBinding_EX" parent="Theme.MaterialComponents.Light.DarkActionBar">
        ● ● ●
    </style>
</resources>

Theme.MaterialComponents.DayNight.DarkActionBar 에서 DayNight를 Light로 바꿔준다.

앱을 빌드 하면 다크 모드와 상관없이 Light 모드로 앱이 실행이 된다.

 

참고 자료
https://es1015.tistory.com/453
https://hanyeop.tistory.com/194
반응형