I'am trying to change whole app theme using
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.AppTheme_ONE);
helper = new PreferenceHelper(this);
super.onCreate(savedInstanceState);
}
Base application theme.
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorHint">@color/colorPrimary</item>
<item name="android:actionButtonStyle">@style/MyActionButtonStyle</item>
<item name="android:typeface">serif</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.ONE" parent="AppTheme.NoActionBar">
<item name="colorPrimary">@color/red</item>
<item name="colorPrimaryDark">@color/red_800</item>
<item name="colorAccent">@color/red_100</item>
<item name="android:textColorHint">@color/red_A700</item>
</style>
but nothing is changing to the toolbar :
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="rtl"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:paddingEnd="10dp"
app:popupTheme="@style/AppTheme.PopupOverlay">
or any layout in the app that use colorPrimary. i have been looking for alot of answers about changing manifest and putting settheme before super.oncreate but nothing changes.
After while i found out that you cant override setTheme if im using default names such as (PrimaryColor
+ PrimaryDarkColor
+ AccentColor
) it worked after i changed it to
(DefaultPrimary
+ DefaultPrimaryDark
+ DefaultAccent
)