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

Why does WeChat lower the overall IQ of Chinese people?

The Internet is a portal. In the past, when peopl...

Smart bracelets now have charging freedom?

In the technological wave of the 21st century, we...

24 ways to attract traffic

As we all know, traffic is the essence of all bus...

Why do we commemorate Liu Hui? What kind of person was he?

On September 24, 2024, in Paris, France, the UNES...

Apple Watch waterproof test: Amazing!

Apple's products have always been destroyed b...

Essential skills for private domain operators: private domain traffic generation

In the private domain operation capability model,...