安卓换肤的一种实现思路

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_29375837/article/details/78697850
/*

用于button的切换事件
*/




    /**
     * 夜间模式切换
     */
    private void isNightMode(){

        Boolean isNight = sp.getBoolean("night", false);
        if (isNight) {
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
            sp.edit().putBoolean("night", false).commit();

        } else {
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
            sp.edit().putBoolean("night", true).commit();
        }


        getActivity().recreate();

    }

猜你喜欢

转载自blog.csdn.net/qq_29375837/article/details/78697850