【发布时间】:2017-08-13 12:49:35
【问题描述】:
将这段代码添加到我的 styles.xml 文件中,以将按钮的原色更改为绿色,即 colorPrimary。
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Button" parent="Base.Widget.AppCompat.Button">
<item name="colorButtonNormal">@color/colorPrimary</item>
</style>
</resources>
然后我尝试将它与涟漪效果结合起来,因为我在另一篇堆栈帖子中读到您需要创建一个涟漪效果 xml 文件并将其用作按钮的背景。然后将按钮的样式设置为style.xml中详述的自定义样式。
我如何链接到编辑器中的按钮
我做错了什么。有没有更简单的方法可以同时为按钮和颜色添加波纹效果。我一直在尝试通过堆栈溢出帖子来解决这个问题,但每个解决方案似乎都不同。我使用的是 API 23。
【问题讨论】:
标签: android android-layout android-view android-theme android-styles