Skip to content

一个通过动态加载本地皮肤包进行换肤的皮肤框架

License

Notifications You must be signed in to change notification settings

cqululei/Android-Skin-Loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android-Skin-Loader

联系我 : [email protected]

一个通过动态加载本地皮肤包进行换肤的皮肤框架

演示

下载demo,将BlackFantacy.skin放在SD卡根目录

效果图

sample

用法

Application中进行初始化

public class SkinApplication extends Application {
	    public void onCreate() {
	            super.onCreate();
		    // Must call init first 
		    SkinManager.getInstance().init(this);
		    SkinManager.getInstance().load();
 	    }
}

在布局文件中标识需要换肤的View

...
xmlns:skin="http://schemas.android.com/android/skin"
...
  <TextView
     ...
     skin:enable="true" 
     ... />

继承SkinPluginActivity作为BaseActivity进行开发

.skin文件中设置皮肤

String SKIN_NAME = "BlackFantacy.skin";
String SKIN_DIR = Environment.getExternalStorageDirectory() + File.separator + SKIN_NAME;
File skin = new File(SKIN_DIR);
SkinManager.getInstance().load(skin.getAbsolutePath(),
				new ILoaderListener() {
					@Override
					public void onStart() {
					}

					@Override
					public void onSuccess() {
					}

					@Override
					public void onFailed() {
					}
				});

重设默认皮肤

SkinManager.getInstance().restoreDefaultTheme();

About

一个通过动态加载本地皮肤包进行换肤的皮肤框架

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%