Android AppCompat 更改 material 按钮的文本颜色
Android AppCompat change text color of material buttons
我想更改按钮的文本颜色,但不知道如何更改(我想使用 AppCompat v22.2 中的按钮)。我尝试了 android:color
、android:textColor
、android:textColorPrimary
和 android:colorForeground
,但这些都不适合我。
你能告诉我哪里出了问题吗?或者展示一个工作示例,你可以将按钮的文本颜色更改为例如绿色?当它结束时我会非常高兴:-)
我找了大约四天的解决方案,所以请不要用 link 回复 Google 搜索。如果您有任何相关信息,请 link that
在布局 XML 中的 Button 定义中有 android:style="?android/textAppearanceSmall"
(activity 是从 LoginActivity 生成的)。我很抱歉(我真的不知道用英语怎么说更好)。
我知道我已经很久没问这个问题了,但我当时自己找到解决方案时不知道如何正确关闭问题,所以我现在这样做,以便用户到这里在他们期望的地方找到他们的答案。
问题是 Button 的样式被设置为 ?android/textAppearanceSmall
(即使我想使用该属性也是错误的 :)),所以它只是退回所有内容的默认值。删除 android:style
属性后,一切正常。
我想更改按钮的文本颜色,但不知道如何更改(我想使用 AppCompat v22.2 中的按钮)。我尝试了 android:color
、android:textColor
、android:textColorPrimary
和 android:colorForeground
,但这些都不适合我。
你能告诉我哪里出了问题吗?或者展示一个工作示例,你可以将按钮的文本颜色更改为例如绿色?当它结束时我会非常高兴:-)
我找了大约四天的解决方案,所以请不要用 link 回复 Google 搜索。如果您有任何相关信息,请 link that
在布局 XML 中的 Button 定义中有
android:style="?android/textAppearanceSmall"
(activity 是从 LoginActivity 生成的)。我很抱歉(我真的不知道用英语怎么说更好)。
我知道我已经很久没问这个问题了,但我当时自己找到解决方案时不知道如何正确关闭问题,所以我现在这样做,以便用户到这里在他们期望的地方找到他们的答案。
问题是 Button 的样式被设置为 ?android/textAppearanceSmall
(即使我想使用该属性也是错误的 :)),所以它只是退回所有内容的默认值。删除 android:style
属性后,一切正常。