android - 膨胀设置 TextView.TextColor 的布局时崩溃

标签 android xamarin xamarin.android textview layout-inflater

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

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

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

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

textColor 值有何不同?

最佳答案

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

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

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

关于android - 膨胀设置 TextView.TextColor 的布局时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45910327/

相关文章:

android - BiometricPrompt 类在 Xamarin Android 中不可用

c# - Mono-Droid 和应用程序交付

c# - 存档的 APK 文件大小非常巨大 - Xamarin.Android

android - ActionBar 选项卡宽度

android - 控制 Android 上的用户语言

android - 空指针异常

android - 如何在 jetpack compose Preview 中显示 Kotlin 协程流数据?

xamarin - 如何在 ScrollView xamarin表单中隐藏滚动条?

xamarin - 无法将 PC 连接到 Mac(Xamarin.iOS 版本不匹配)

xamarin - 如何在 xamarin.android 中将 dp 转换为 px?