源码简介
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();
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
源码下载:http://down.51cto.com/data/1982408