展开设置 TextView.TextColor 的布局时崩溃

Crash when inflating a layout that sets the TextView.TextColor

如果布局将 TextView 的 textColor 设置为以下内容,我将无法扩充布局...

android:textColor="?android:attr/textColor"

我相信该值肯定是为应用程序定义的,因为我有一个也引用此资源的可绘制对象并且它工作得很好。但是,如果我尝试使用强调色,那么它会很好用,例如

android:textColor="?android:attr/colorAccent"

textColor 值有何不同?

我将不得不假设您正在寻找主题的主要文本颜色,因此您将使用:

android:textColor="?android:attr/textColorPrimary"

有十几个 textColorXXXX 属性,因此您需要查看它们以了解您实际尝试使用的是哪一个。