我正在设置一些默认值 styles
对于我的应用程序,我想要 ?android:attr/textAppearanceMedium
作为 style
的 parent ...但我不能,Android Studio 提示该引用,所以我不得不改为将父级设置为 parent="@android:style/TextAppearance.Medium"
.
问题是 @android:style/TextAppearance.Medium"
我不一样了text color
作为?android:attr/textAppearanceMedium
确实如此,所以我想知道如何找到 ?android:attr/textAppearanceMedium
指向的正确样式?
最佳答案
您的应用主题应该扩展其中一个框架主题或您的依赖项之一中的主题(例如 AppCompat)。您可以在 Android Studio 中导航到父主题,就像您可以跳转到方法的实现一样(对我来说是 command
+ 单击)。
?android:attr/textAppearanceMedium
的值取决于当前主题,因此您可能必须为声明的每个主题执行此操作。另请注意,样式可能会有所不同,具体取决于您运行的 API 级别,因此您可能必须执行相同的操作。
编辑
由于您对影响文本颜色感兴趣,作为替代方案,您可以考虑在主题中为 android:textColorPrimary
和 android:textColorSecondary
设置一个值。
关于android - 查找 "?android:attr/textAppearanceSmall",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37198332/