One-click skinning

One-click skinning

Source code introduction

Screenshot of source code running to implement one-click skinning of APP

Source code snippet:

  1. public   final   static String SHARED_PREFERENCES_NAME = "andnav_preferences" ;
  2.   
  3. public   final   static String PREF_THEME_RESID_ID = "theme_resid" ;
  4.       
  5. public   final   static String TITLE_ID = "title_id" ;
  6.       
  7. public   static   void setTitle(Activity act)
  8. {
  9. SharedPreferences sPref = act.getSharedPreferences(SHARED_PREFERENCES_NAME, 0 );
  10. TextView title = (TextView) act.findViewById(R.id.titleTv);
  11. int title_resid = sPref.getInt(TITLE_ID, R.drawable.color1);
  12. title.setBackgroundResource(title_resid);
  13. }
  14. public   static   void setValue(Activity act, int theme_resid, int title_resid)
  15. {
  16. SharedPreferences sPref = act.getSharedPreferences(SHARED_PREFERENCES_NAME, 0 );
  17. Editor editor = sPref.edit();
  18. editor.putInt(PREF_THEME_RESID_ID, theme_resid);
  19. editor.putInt(TITLE_ID, title_resid);
  20. editor.commit();
  21. }

Source code download: http://download..com/data/1982408

<<:  Google Talk, once a favorite among programmers, will be shut down next week

>>:  NDRC fined Qualcomm 6.1 billion yuan and required Qualcomm to make five rectifications

Recommend

8.18 The bumpy love stories of Internet tycoons

[[123283]] "Getting promoted, getting a rais...

Changhong CHiQ iteratively updates game content to make the product younger

April 1 (Reporter Zhang Zhichang) For home applia...

What should we pay attention to when placing the Wenchang Tower?

1. Introduction to Wenchang Tower Wenchang Pagoda...

There are 100 ways to gain followers on WeChat. Which ones have you learned?

People often ask me how to add people. Here is a ...

16 negotiations for 2 seconds! That night 25 years ago...

2 seconds, 23 seconds, 12 seconds There is a stor...

How to improve the style of APP interface in details?

[[140092]] The times are always changing in a spi...

Copywriting: A universal formula for constructing good copy

In daily life or work, the cultivation of words, ...