@author vivian8725118
@CSDN http://blog.csdn.net/vivian8725118
@简书 http://www.jianshu.com/p/832e9776e317
近期公司的项目在做夜间模式,使用了鸿洋的changeskin。一个很好用的library。在这里总结一下使用过程中遇到的各种问题和解决的方法。
使用方法
下载changeskin,作为module依赖至主项目,比如:
dependencies {
compile project(':changeskin')
}
或者直接加入依赖:
dependencies {
compile 'com.zhy:changeskin:3.0.0'
}
ps:之前是加入了依赖,后来为了支持自己定义 view,把整个 library 作为项目文件放进来了,不然识别不了自己的 view
1.Application中初始化
public class MyApplication extends Application
{
@Override
public void onCreate()
{
super.onCreate();
SkinManager.getInstance().init(this);
}
}
2.继承BaseSkinActivity
让全部的须要换肤的界面的Activity。继承自com.zhy.changeskin.base.BaseSkinActivity。
3、对于须要换肤的资源命名使用skin开头
比方你的某个控件的背景须要换肤:
<android.support.v4.widget.DrawerLayout
android:background="@drawable/skin_main_bg"
...
/>
字体颜色:
<TextView android:id="@+id/id_tv_title"
android:textColor="@color/skin_item_text_color"
/>
应用内换肤
1、准备资源apk
这个就简单了,由于应用内换肤那么你肯定有多套资源,比方有一个背景图叫做:
skin_main_bg
那么你能够准备一套皮肤资源,命名为:
skin_main_bg_后缀
2、调用换肤API
浅谈Vue.use
js 限制输入框只能输入数字的问题
vue computed的执行问题
前端 html 篇
函数声明 及 名称问题
文件读写操作
异常以及异常处理框架探析
使用JDBC插入数据到ORACLE,使用标识列自增列
session超时跃出iframe并跳到登陆页面(转载)
- 最新文章
-
电脑点右键反应慢的解决办法
EC读书笔记系列之17:条款41、42、43、44、45、46
Python核心编程读笔 13:执行环境
Python核心编程读笔 12:OOP
Python核心编程读笔 11:模块
Python核心编程读笔 10:函数和函数式编程
Python核心编程读笔 9: 异常
vue告警信息:{ parser: "babylon" } is deprecated.
vue警告: component lists rendered with v-for should have explicit keys
vue启动时报 This relative module was not found