ABDO-AR
ABDO-AR

Reputation: 344

How to set light theme by default in Android?

How to set light theme by default in Android?

I need to know how can I set light theme by default even if the user enable dark theme in his smart phone with Java code.

Upvotes: 2

Views: 4252

Answers (1)

Shoaib Kakal
Shoaib Kakal

Reputation: 1336

You can do this by just copying light theme Properties into Night theme file.

Go to res>values>themes.

In themes folder, you will see two files themes.xml and themes.xml(night).

Step 1:

  • Copy All themes.xml colors and paste them into themes.xml(night).

Step 2:

  • Replace the Base application theme in both files.

Replace this

<style name="<app name here>" parent="Theme.MaterialComponents.DayNight.DarkActionBar">

to this

<style name="Theme.CurrentLocation" parent="Theme.MaterialComponents.Light">

Upvotes: 3

Related Questions