我最近添加了 this我的 Android 项目中的 GitHub 存储库,所以我继续添加我的 gradle 依赖项,如下所示:
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.github.rey5137:material:1.2.2'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
当我放一个自定义 View 时,如果我使用带有绿锁的自定义 View ,那没关系,但是当我放一个带有红锁的 View 时,会出现“渲染问题”错误。
¿ 我应该怎么做?
最佳答案
您无法使用该依赖项做任何事情。
我们可以举个例子:
InternalEditText in EditText
这意味着 InternalEditText 是 EditText 的内部类。红色的锁表示它是一个私有(private)类,所以 EditText 类的结构是:
public class EditText {
private class InternalEditText {
}
}
所以你不能直接访问那个类。
解决方案
顺便说一句,你为什么要使用那些内部私有(private)类?该项目对于在 Lollipop 前设备上使用 Material 小部件很有用,因此对于 EditText(例如),您可以使用
com.rey.material.widget.EditText
关于android - 为什么外部 CustomViews 有红色锁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35384506/