首页 > 解决方案 > Question on importing two classes with the same name - android.graphics.Color

问题描述

I currently have a imported color class from another Android Library:

import com.google.ar.sceneform.rendering.Color;

but I need to import another color class:

import android.graphics.Color;

but after typing this import, it gives me the error:

enter image description here

so I have to end up removing the second import and use it manually like this:

mBtnColor.setColorFilter(android.graphics.Color.parseColor(color));

is there a way I can import both classes? or maybe use the second import without typing android.graphics.Color?

标签: android

解决方案


创建两个类:一个继承第一个 Color,什么也不做,称为 AndroidGraphicsColor,另一个继承相应的类,称为 AndroidSceneFormRenderingColor。然后使用它们。


推荐阅读