【发布时间】:2020-10-11 20:15:19
【问题描述】:
我在 android studio 上将按钮颜色更改为黑色,如下所示: 在colors.xml中:
<color name="colorBlack">#000000</color>
在styles.xml中:
<style name="AppTheme.Button" parent="Base.Widget.AppCompat.Button">
<item name="colorButtonNormal">@color/colorBlack</item>
</style>
在 layout_frag.xml 中:
<Button
android:id="@+id/button"
android:theme="@style/AppTheme.Button"
android:layout_width="match_parent"
android:layout_height="75dp"
android:text="@string/hello_first_fragment"
android:textColor="@color/design_default_color_background" />
我的黑色按钮可以正常工作,尽管按下按钮时的色调背景颜色操作不再起作用,因为按钮非常暗并且色调通常为深灰色。 ![Button2 onClick 变成灰色][1] 我想知道单击按钮时在哪里可以更改着色操作?
【问题讨论】:
标签: android xml android-button android-theme material-components-android