There is a certain problem: when changing the background in the toolbar to black or dark using the button (that is, changing the theme), a white rectangle appears against the text and the font is reduced (see photo). Here is the styles.xml code
<style name="LightTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">#4d5056</item> <!-- colorPrimaryDark is used for the status bar --> <item name="colorPrimaryDark">#4d5056</item> <item name="colorAccent">#009688</item> </style> <style name="AMOLEDTheme" parent="Theme.AppCompat.NoActionBar"> <item name="colorPrimaryDark">#000000</item> <item name="colorPrimary">#000000</item> <item name="toolbarStyle">@style/ToolBarAMOLED</item> </style> <style name="DarkTheme" parent="Theme.AppCompat.NoActionBar"> <item name="android:background">#2b2e30</item> <item name="colorPrimaryDark">#2b2e30</item> <item name="toolbarStyle">@style/ToolBarDark</item> </style> <style name="ToolBarLight"> <item name="android:background">#ffffff</item> </style> <style name="ToolBarAMOLED"> <item name="android:background">#000000</item> </style> <style name="ToolBarDark"> <item name="android:background">#2b2e30</item> </style> toolbar.xml
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/my_toolbar" app:titleTextColor="#616266" android:minHeight="?attr/actionBarSize" android:theme="@style/ToolBarLight" android:elevation="0.5dp"> </android.support.v7.widget.Toolbar> 