小编And*_*dry的帖子

Android - 深色模式问题:深色背景上的黑色文本

当我启用深色模式时,我的应用程序上的某些菜单看起来很糟糕:非常暗的背景上的黑色文本。我对颜色完全是一个初学者。

在此输入图像描述

我还没有接触过 android studio 上默认颜色设置的任何内容,所以我有默认的两个主题 XML 和 Color Xml:

     <resources xmlns:tools="http://schemas.android.com/tools">
     <!-- Base application theme. -->
     <style name="Theme.TestSS" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
         <!-- Primary brand color. -->
         <item name="colorPrimary">@color/purple_500</item>
         <item name="colorPrimaryVariant">@color/purple_700</item>
         <item name="colorOnPrimary">@color/white</item>
         <!-- Secondary brand color. -->
         <item name="colorSecondary">@color/teal_200</item>
         <item name="colorSecondaryVariant">@color/teal_700</item>
         <item name="colorOnSecondary">@color/black</item>
         <!-- Status bar color. -->
         <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
         <!-- Customize your theme here. -->
     </style>

     <style name="Theme.TestSS.NoActionBar">
          <item name="windowActionBar">false</item>
          <item name="windowNoTitle">true</item>
     </style>

     <style name="Theme.TestSS.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

     <style name="Theme.TestSS.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
   </resources>
Run Code Online (Sandbox Code Playgroud)

和:

    <resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. --> …
Run Code Online (Sandbox Code Playgroud)

android themes colors android-dark-theme android-darkmode

11
推荐指数
3
解决办法
3万
查看次数