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

Reflections on the failed Meituan iOS interview

Daily nonsense Since last year, I have been tryin...

Looks cute LeTV Kids Desktop Getting Started Guide

Hello, children! Our own LeTV children's desk...

Panasonic plans to develop fully autonomous electric vehicles

According to a report by Kyodo News, Panasonic is...

An article to show you 20 new changes in iOS 12 Beta 5

A few days ago, Apple released the iOS 12 beta 5 ...

Xiaohongshu keyword ranking strategy!

|Directory| 1. Xiaohongshu search ranking 2. The ...

Douyin Training Camp Project Practice (Operation)

As the pressure of employment competition becomes...

Online operation strategy

The following is an outline of the content of thi...

How much does it cost to join the Zibo Second-hand Car Mini Program?

Is it easy to join the Zibo Second-hand Car Mini ...

Turtle Class·Taobao Virtual No-Source E-commerce Course 5

The course comes from the 1st, 4th and 5th editio...

Spring is here. Do you know the top wild vegetables?

When spring comes, many people start to miss wild...

Getting Started with WatchKit: Creating a Simple Guessing Game

Editor's note: As you know, Apple has include...

Detailed explanation of Windows 10's Wi-Fi sharing feature

Ever since Windows 10 officially debuted last wee...