按钮样式主题在Android Dark主题模式下不起作用(Theme.MaterialComponents.DayNight)

时间:2020-01-17 10:19:12

标签: android material-components-android android-dark-theme

我在background attribute中应用了一个Android android button。在day/light模式下,该属性可以完美地应用而没有问题,但是在切换到night/dark mode时,该属性不被应用,并且带有grey background的按钮而不是{{1} }。

这是我的android按钮代码:

theme applied

这是我为背景绘制的代码:

 <Button
                android:id="@+id/logoutbtn"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/view2"
                android:layout_centerHorizontal="true"
                android:text="@string/logout_text"
                android:textSize="14sp"
                android:typeface="normal"
                android:layout_marginTop="5dp"
                android:layout_marginStart="50dp"
                android:layout_marginEnd="50dp"
                android:layout_marginBottom="20dp"
                android:background="@drawable/button_background_accent_rounded"
                />

我得到的输出是:

  1. 白天模式

1. for Day mode

  1. 夜间模式

2. for night mode

高度赞赏在不更改Java代码的情况下提供的任何帮助或建议。

0 个答案:

没有答案