Глобально изменить стили с наследованием Android - PullRequest
0 голосов
/ 05 апреля 2020

У меня xml экран активности, и мне нужно изменить наследование стиля:

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".activity.Authentication"
    android:fitsSystemWindows="true"

    android:theme="@style/AppTheme.Light">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="12dp"
        android:layout_alignParentTop="true"
        tools:ignore="MissingConstraints"
        android:fitsSystemWindows="true"
        style="@style/TextView"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

TextView - это наследие от темы Light, но если я изменяю тему на Dark, мне нужно автоматически установить стиль на тему TextView из TextView родитель DarkTheme.

<style name="TextView" parent="AppTheme.Dark">

    <item name="android:background">#000000</item>
    </style>

    <style name="TextView" parent="AppTheme.Light">
        <item name="android:background">#FFFFFF</item>
    </style>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...