I am developing an app where it will be possible to switch between night and day mode. To do that I want to set theme for ConstraintLayout so it's children will inherit this theme, but they don't...
I mean particularly the TextView color, even if I set the ConstraintLayout theme where textColor attribute is light, the TextView stays dark.
Anyone knows what it is going on? Or I'm doing something wrong?
Theme is described in styles.xml, I've tried setting other two attributes - textAppearance and textViewStyle, none of them work. I've also tried setting this in styles-v21 it didn't work. But when I set this theme directly in TextView, it does work. But I want to avoid spending so much time changing all TextViews manually, also don't want to waste processor time calling findViewById on all views...
This is the parent ConstraintLayout attributes :
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_constraint_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/drawerColorDark"
android:gravity="bottom"
android:theme="@style/AppThemeDark.Drawer">
One of the TextViews :
<TextView
android:id="@+id/drawer_all_articles_text"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:gravity="center"
android:text="All Articles"
android:textSize="18sp"
app:layout_constraintStart_toEndOf="@+id/drawer_all_articles_icon"
app:layout_constraintTop_toTopOf="parent" />
And the styles code (not much cause still trying to move forward with inheritance on this example...) :
<style name="AppThemeDark" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppThemeDark.Drawer" parent="AppThemeDark">
<item name="android:textColor">@color/drawerTextDark</item>
<item name="android:textAppearance">@color/drawerTextDark</item>
<item name="android:textViewStyle">@color/drawerTextDark</item>
</style>
<style name="AppThemeDark.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
Many Thanks in advance,