这是我设置按钮的方法。
<Button
android:id="@+id/button_login"
style="@style/ButtonStyle"
android:text="@string/button_login" />
这是我在values文件夹中的样式。
<style name="ButtonStyle" parent="ButtonStyleBase" />
<style name="ButtonStyleBase">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">@dimen/padding</item>
<item name="android:textSize">@dimen/font_regular</item>
<item name="android:textColor">@color/text_regular</item>
<item name="android:background">@drawable/shape_clickable</item>
</style>
这是我在values-v21文件夹中的样式
<style name="ButtonStyle" parent="ButtonStyleBase">
<item name="textAllCaps">false</item>
<item name="android:textColor">#000000</item>
</style>
但是按钮上的文本总是大写的。如果我直接在按钮上设置它,它会恢复正常。我更改了颜色以查看是否正在使用api 21的样式,它确实被使用了,按钮文本颜色在api 21上变为黑色。我知道默认主题将textAllCaps设置为按钮的true,因为Google认为这很酷,但它不应该优先考虑我的样式吗?
编辑:不要紧,我忘记在样式上写"android:"了。