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

Is yellow urine a sign of getting angry?

“You can tolerate feces, but not urine”, although...

How to open WeChat mini-programs with QQ browser?

Following WeChat and QQ, mini programs can now be...

Mobile phone ordering project source code

Source code introduction: Mobile phone ordering p...

The KOL purchased for 30 million has high conversion rate!

In recent years, driven by major MCN agencies, ad...

Apple's electric car will become a nightmare for the automotive industry

Foreign media published an analytical article on ...

The entire process of setting up a bidding promotion account!

When we get a new bidding promotion account, the ...

Analysis of the full activity of Zebra AI course APP for old and new students

1. Case Link Official website personal center ent...

Huh? Why are potatoes now "swollen"...

Review expert: Xia Xiaofei, Secretary General of ...

WP10 may be renamed Windows Mobile 10, weird name?

Editor's note: I am exhausted from complainin...

How to write copy that takes advantage of the Lantern Festival?

The Lantern Festival is coming soon. How to write...