1.将AppTheme的parent 设置为Theme.AppCompat.Light.*
2.在AppTheme中添加item forceDarkAllowed 为false
3.在AndroidMainfast.xml 文件中引用AppTheme
举例:
themes.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
......
<item name="android:forceDarkAllowed">false</item>
</style>
</resources>
AndroidMainfest.xml
<application
android:name=".Application"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
......
</application>