hust201010701 / XRadarView

A highly customizable radar view for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

不能和Material Design 一起使用,如何解决?

aiLvXuan opened this issue · comments

和Material Design 的 属性文件撞一起了。

Information:Gradle tasks [:zhxy:generateDebugSources, :zhxy:generateDebugAndroidTestSources, :zhxy:mockableAndroidJar, :follow:generateDebugSources, :follow:generateDebugAndroidTestSources, :follow:mockableAndroidJar, :chained:generateDebugSources, :chained:generateDebugAndroidTestSources, :chained:mockableAndroidJar]
C:\Users\Administrator.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\2a6a5fcbca7d820cb35027346122b6d8\res\values\values.xml
Error:(246, 5) Attribute "borderWidth" already defined with incompatible format.
Error:(246, 5) Original attribute defined here.
D:\Android\TestDemo\zhxy\build\intermediates\res\merged\debug\values\values.xml
Error:(540) Attribute "borderWidth" already defined with incompatible format.
Error:(396) Original attribute defined here.
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process D:\Android\sdk\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I D:\Android\sdk\platforms\android-26\android.jar -M \?\D:\Android\TestDemo\zhxy\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\Android\TestDemo\zhxy\build\intermediates\res\merged\debug -m -J \?\D:\Android\TestDemo\zhxy\build\generated\source\r\debug -F D:\Android\TestDemo\zhxy\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.lsy.zhxy -0 apk --output-text-symbols \?\D:\Android\TestDemo\zhxy\build\intermediates\symbols\debug --no-version-vectors}
Error:com.android.ide.common.process.ProcessException: Error while executing process D:\Android\sdk\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I D:\Android\sdk\platforms\android-26\android.jar -M \?\D:\Android\TestDemo\zhxy\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\Android\TestDemo\zhxy\build\intermediates\res\merged\debug -m -J \?\D:\Android\TestDemo\zhxy\build\generated\source\r\debug -F D:\Android\TestDemo\zhxy\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.lsy.zhxy -0 apk --output-text-symbols \?\D:\Android\TestDemo\zhxy\build\intermediates\symbols\debug --no-version-vectors}
Error:org.gradle.process.internal.ExecException: Process 'command 'D:\Android\sdk\build-tools\26.0.2\aapt.exe'' finished with non-zero exit value 1
Error:Execution failed for task ':zhxy:processDebugResources'.

Failed to execute aapt

提供一个解决方案:
1.单独复制 XRadarView.class, 2.复制R文件的 class styleable{ },放入XRadarView.class,当做一个私有的内部类,然后就可以拿着这个XRadarView.class, 当做一个自定义的布局放心的去使用了。

(现在又遇到个小问题,项目需求图标放在文字下放,而XRadarView 是图标放在文字的右边,这个我想我还需要自己动手做一下补充修改,希望作者可以考虑一下完善,可以自定义图标和文字的相对位置)

——————————————————————分割线——————————————————

学习了属性的定义和使用、aar包的使用,觉得以上做法太蠢了,还有可能潜藏bug,现在是使用修改attrs.xml后生成aar包的方法,完美运行。

截图-->
uc 20180425122856

1.0.5版本已经解决冲突问题。原来的borderWidth替换为boundaryWidth。

@aiLvXuan

希望作者可以考虑一下完善,可以自定义图标和文字的相对位置

这里你有什么想法么?基础库如何暴露api给业务方控制图标与文字的相对位置。

@hust201010701

基础库如何暴露api给业务方控制图标与文字的相对位置。

这个还没什么想法,之前项目赶,和ios、设计她们商量一下改了设计图,然后没考虑这个了

commented

我也遇到了这个问题,不过是lineColor这个属性冲突了。也是改了之后当做自定义View来用的,感觉自定义属性还是蛮多坑的

@hust201010701 作者说更新了这个小问题了,应该没什么问题了吧? 主要是没有自己的标识,使用的通用的属性名称,很容易和Google自带Api或者其他第三方库冲突,改一下名字就行了,之前我是把源码下载下来,改完属性做成aar包

commented

没啥大问题,挺好的,我跟你的做法一样