源码简介
APP一键换肤的实现
源码运行截图
源码片段:
- public final static String SHARED_PREFERENCES_NAME = "andnav_preferences";
- public final static String PREF_THEME_RESID_ID = "theme_resid";
- public final static String TITLE_ID ="title_id";
- public static void setTitle(Activity act)
- {
- SharedPreferences sPref = act.getSharedPreferences(SHARED_PREFERENCES_NAME, 0);
- TextView title = (TextView) act.findViewById(R.id.titleTv);
- int title_resid = sPref.getInt(TITLE_ID, R.drawable.color1);
- title.setBackgroundResource(title_resid);
- }
- public static void setValue(Activity act,int theme_resid,int title_resid)
- {
- SharedPreferences sPref = act.getSharedPreferences(SHARED_PREFERENCES_NAME, 0);
- Editor editor = sPref.edit();
- editor.putInt(PREF_THEME_RESID_ID, theme_resid);
- editor.putInt(TITLE_ID, title_resid);
- editor.commit();
- }
源码下载:http://down.51cto.com/data/1982408