2

I have an app that consists of two fragments connected with ViewPager. The one on the left has custom background, the one on the right has basic light theme (white background, black text color, etc.). Now I want to implement DayNight theme to the right fragment (not to the one that has custom background). I tried to set DayNight to the main activity in AndroidManifest, but it changed the whole app - the left fragment and the right fragment.

Manifest:

android:theme="@style/MyTheme"

Styles.xml:

<style name="MyTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
   ...
</style>

Is it possible to set DayNight theme to only one of them? Thank you very much for your advice.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Tom11
  • 2,419
  • 8
  • 30
  • 56
  • Hi Tom11. This is the only question with the theme-daynight tag. You seem to know what it means, so can I ask you to define and explain? Otherwise the tag is so unhelpful. – Yunnosch Mar 08 '20 at 11:34
  • Hi, DayNight theme is specific color theme that changes according to time of the day and battery status. It is applicable **not only** for Android applications. – Tom11 Mar 08 '20 at 11:51

0 Answers0