fengjundev / android-skin-loader Goto Github PK
View Code? Open in Web Editor NEW一个通过动态加载本地皮肤包进行换肤的皮肤框架
License: Apache License 2.0
一个通过动态加载本地皮肤包进行换肤的皮肤框架
License: Apache License 2.0
我试了一下不行
SettingItem settingItem1 = new SettingItem(getString(R.string.setting_wifi), R.mipmap.ic_setting_wifi);
SettingItem settingItem2 = new SettingItem(getString(R.string.setting_general), R.mipmap.ic_setting_about);
SettingItem settingItem3 = new SettingItem(getString(R.string.setting_date_time), R.mipmap.ic_setting_date);
SettingItem settingItem4 = new SettingItem(getString(R.string.setting_effect), R.mipmap.ic_setting_effect);
SettingItem settingItem5 = new SettingItem(getString(R.string.setting_display), R.mipmap.ic_setting_display);
SettingItem settingItem6 = new SettingItem(getString(R.string.setting_shutdown), R.mipmap.ic_setting_power_off);
SettingItem settingItem7 = new SettingItem(getString(R.string.setting_sleep), R.mipmap.ic_setting_sleep);
SkinManager 中L205行 if(!skinObservers.contains(skinObservers))判断代码如下
@Override
public void attach(ISkinUpdate observer) {
if(skinObservers == null){
skinObservers = new ArrayList<ISkinUpdate>();
}
if(!skinObservers.contains(skinObservers)){
skinObservers.add(observer);
}
}
应该修改为 observer。
SkinManager attach方法关于observer是否已经add的判断有问题
if(!skinObservers.contains(skinObservers)){
skinObservers.add(observer);
}
使用include添加的布局没有效果
在ListView和GridView里面更换主题,如果是Item的同一个ImageView在不同的位置设置了不同的图片(使用的是java代码,不是xml,xml是上下滚动正常的,但是项目中会遇到不同的position显示不同的图片),那么切换之后只由当前页显示是正常的图片,上下滚动之后会用原来内置的图片,请问这个问题如何解决?望回复。。。
java.lang.UnsupportedClassVersionError: com/android/build/gradle/LibraryPlugin : Unsupported major.minor version 52.0
as版本是2.2.3。java版本是1.8,有遇到过这个问题的吗?
不支持自定义属性吗
SkinInflaterFactory引起了fragment的泄露。SkinInflaterFactory是activity唯一,如果activity里面有很多fragment,例如使用了viewpager。会导致viewpager里面的fragment泄露。
SkinManager 的 getDrawable 写的不严谨,在未找到资源时应该最后再将新的drawable设置为 original drawable, not found exception 被吞掉了,坑!
Caused by: java.lang.IllegalStateException: A factory has already been set on this LayoutInflater
反复尝试,皮肤文件没问题,换用 普通 Activity来做主页也没问题,
应该是 BaseFragmentActivity的问题,不知其他人有无相同问题。
比如
TextView tv=(TextView)findViewById(R.id.tv);
tv.setTextColor(R.color.color_tv);
这样的资源color_tv我试了一下好像也没办法切换主题,我通过dynamicAddView也不起作用。
V7 AppCompatActivity 重写兼容不
发现好久没有更新了
这个换肤不能作用在状态选择器中吗??真心求解
我想在切换主题的时候,更换shape,但不知道怎么做,求大神赐教
如果我在布局中使用了条件判断那么换肤的功能就不会生效了,比如android:textColor=“@{ifChange ? @color/1 : @color/2}}”
Field field = LayoutInflater.class.getDeclaredField("mFactorySet");这行代码
在6.0 系统上,无法更新皮肤功能,定位到代码是因为 对 sdcard读取权限的问题
@Override
protected Resources doInBackground(String... params) {
try {
if (params.length == 1) {
String skinPkgPath = params[0];
File file = new File(skinPkgPath);
if(file == null || !file.exists()){
return null;
}
PackageManager mPm = context.getPackageManager();
PackageInfo mInfo = mPm.getPackageArchiveInfo(skinPkgPath, PackageManager.GET_ACTIVITIES);
skinPackageName = mInfo.packageName;
AssetManager assetManager = AssetManager.class.newInstance();
Method addAssetPath = assetManager.getClass().getMethod("addAssetPath", String.class);
addAssetPath.invoke(assetManager, skinPkgPath);
Resources superRes = context.getResources();
Resources skinResource = new Resources(assetManager,superRes.getDisplayMetrics(),superRes.getConfiguration());
SkinConfig.saveSkinPath(context, skinPkgPath);
skinPath = skinPkgPath;
isDefaultSkin = false;
return skinResource;
}
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
};
代码L160,获取的mInfo == null。
RT
用background可以
Could not get unknown property 'assembleRelease' for project
使用这样的方法是可以的,已经测试通过了。
在布局中给FrameLayout android.support.design.widget.CollapsingToolbarLayout 等组件添加skin:enable="true"时是无效的,无法起到动态换肤的作用。因为SkinInflaterFactory中的
private View createView(Context context, String name, AttributeSet attrs) {
View view = null;
try {
if (-1 == name.indexOf('.')){
if ("View".equals(name)) {
view = LayoutInflater.from(context).createView(name, "android.view.", attrs);
}
if (view == null) {
view = LayoutInflater.from(context).createView(name, "android.widget.", attrs);
}
if (view == null) {
view = LayoutInflater.from(context).createView(name, "android.webkit.", attrs);
}
}else {
view = LayoutInflater.from(context).createView(name, null, attrs);
}
L.i("about to create " + name);
} catch (Exception e) {
L.e("error while create 【" + name + "】 : " + e.getMessage());
view = null;
}
return view;
}
这两种view FrameLayout 和android.support.design.widget.CollapsingToolbarLayout 在执行这个方法时会跑出异常最后返回空return null,后面也就不会再读取属性信息了,整个换肤的设置也就无效了。
目前测试的是这两个view,但不排除还有其他View也不支持,这样的话,这个坑就很大了
Gradle sync failed: Could not get unknown property 'assembleRelease' for project ':android-skin-loader-skin' of type org.gradle.api.Project.
Consult IDE log for more details (Help | Show Log) (13s 218ms)
android 8.0 使用无反应
我问得太急了,不知道怎么删除,那就还是给跟我一样蠢的新手提示一下吧= =就是用File->Invalidate Caches/Restart重启一下就行了
状态栏颜色适配时创建的StatusBarView,调用dynamicAddView()方法,没有作用?
1.skin如何生成
2.导入项目后查不到skin字段 Unexpected namespace prefix "skin" found for tag Button
试了好多种方法,用排除法后发现,我的layout都是继承父布局,通过viewGroup加载在容器中,然后换肤就失效了,是不是因为使用容器而定位不到view
Hola! @yeungeek has created a ZenHub account for the fengjundev organization. ZenHub is the only project management tool integrated natively in GitHub – created specifically for fast-moving, software-driven teams.
To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.
ZenHub adds a series of enhancements directly inside the GitHub UI:
Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @yeungeek.
再创建一个drawable,将hdpi的资源复制过来可以用。
请问如何支持drawable-hdpi呢?
请问现在支持ViewStub吗,在使用的时候貌似发现不能
有时候新增了文件,生成的皮肤包并没有新的文件。这个时候clean 一下,反而不生成了。重启一下,过一会,可能又能生成。
有一个看起来和使用起来都和你这个库十分像的项目:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.