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

Bidding Models in Internet Advertising - Alliance, RTB, RTA

In (Part 1 - Basic Bidding) and (Part 2 - Smart B...

13 billion years old! What secrets can a new type of star reveal to us?

Gold in our galaxy may be linked to the explosion...

Facebook open-sources Spectrum to make uploading large images easier

With the improvement of the performance of mobile...

4 Effective Strategies to Increase App User Engagement

The definition of user engagement varies from pro...

Glutinous or sweet? The "corn dispute" escalates again!

Popular Science Times reporter Wu Qiong Recently,...

How to do Spring Festival marketing? February Marketing Calendar is here!

Time flies so fast, and it is already 2022. Vario...

How to revive an old Douyin account? Can the old Douyin account be restored?

Every day, many Douyin video users register new a...

How to join Meituan Alliance? What is the fee standard for Meituan promotion?

Since the opening of Meituan Alliance , some peop...

Who are the people who choose to buy 4G mobile phones now?

Although 5G mobile phones are already very common...